Re: [PATCH] bttv: fix mutex use before init

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Brandon Philips
Date: Friday, December 17, 2010 - 9:07 am

On 19:45 Wed 15 Dec 2010, Mauro Carvalho Chehab wrote:

Thanks, but, why wasn't this done instead of c37db91f?

Will this make it in before 2.6.37 is released? Otherwise 2.6.37 will
need to be fixed in -stable immediatly after release.


Could you take this patch to remove all of the comments about locking
order with btv->lock since it doesn't seem to matter any longer.

Cheers,

	Brandon

P.S. Your mail client creates really long lines- somewhere around 90
characters. Could you fix that?

From 7643db7bf5e9e557a27e3783786a1abecbdf82a7 Mon Sep 17 00:00:00 2001
From: Brandon Philips <brandon@ifup.org>
Date: Fri, 17 Dec 2010 07:58:22 -0800
Subject: [PATCH] bttv: remove unneeded locking comments

After Mauro's "bttv: Fix locking issues due to BKL removal code" there
are a number of comments that are no longer needed about lock ordering.
Remove them.

Signed-off-by: Brandon Philips <bphilips@suse.de>
---
 drivers/media/video/bt8xx/bttv-driver.c |   20 --------------------
 1 files changed, 0 insertions(+), 20 deletions(-)

diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c
index 25e1ca0..0902ec0 100644
--- a/drivers/media/video/bt8xx/bttv-driver.c
+++ b/drivers/media/video/bt8xx/bttv-driver.c
@@ -2358,13 +2358,6 @@ static int setup_window_lock(struct bttv_fh *fh, struct bttv *btv,
 	fh->ov.field    = win->field;
 	fh->ov.setup_ok = 1;
 
-	/*
-	 * FIXME: btv is protected by btv->lock mutex, while btv->init
-	 *	  is protected by fh->cap.vb_lock. This seems to open the
-	 *	  possibility for some race situations. Maybe the better would
-	 *	  be to unify those locks or to use another way to store the
-	 *	  init values that will be consumed by videobuf callbacks
-	 */
 	btv->init.ov.w.width   = win->w.width;
 	btv->init.ov.w.height  = win->w.height;
 	btv->init.ov.field     = win->field;
@@ -3219,15 +3212,6 @@ static int bttv_open(struct file *file)
 		return -ENOMEM;
 	file->private_data = fh;
 
-	/*
-	 * btv is protected by btv->lock mutex, while btv->init and other
-	 * streaming vars are protected by fh->cap.vb_lock. We need to take
-	 * care of both locks to avoid troubles. However, vb_lock is used also
-	 * inside videobuf, without calling buf->lock. So, it is a very bad
-	 * idea to hold both locks at the same time.
-	 * Let's first copy btv->init at fh, holding cap.vb_lock, and then work
-	 * with the rest of init, holding btv->lock.
-	 */
 	*fh = btv->init;
 
 	fh->type = type;
@@ -3302,10 +3286,6 @@ static int bttv_release(struct file *file)
 
 	/* free stuff */
 
-	/*
-	 * videobuf uses cap.vb_lock - we should avoid holding btv->lock,
-	 * otherwise we may have dead lock conditions
-	 */
 	videobuf_mmap_free(&fh->cap);
 	videobuf_mmap_free(&fh->vbi);
 	v4l2_prio_close(&btv->prio, fh->prio);
-- 
1.7.3.1

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] bttv: fix mutex use before init, Dave Young, (Sun Dec 12, 6:15 am)
Re: [PATCH] bttv: fix mutex use before init, Torsten Kaiser, (Sun Dec 12, 9:13 am)
Re: [PATCH] bttv: fix mutex use before init, Dave Young, (Mon Dec 13, 7:04 am)
Re: [PATCH] bttv: fix mutex use before init, Torsten Kaiser, (Mon Dec 13, 12:06 pm)
Re: [PATCH] bttv: fix mutex use before init, Brandon Philips, (Mon Dec 13, 5:30 pm)
Re: [PATCH] bttv: fix mutex use before init, Dave Young, (Tue Dec 14, 5:05 am)
Re: [PATCH] bttv: fix mutex use before init, Torsten Kaiser, (Tue Dec 14, 1:56 pm)
Re: [PATCH] bttv: fix mutex use before init, Torsten Kaiser, (Tue Dec 14, 2:13 pm)
Re: [PATCH] bttv: fix mutex use before init, Brandon Philips, (Tue Dec 14, 2:43 pm)
Re: [PATCH] bttv: fix mutex use before init, Brandon Philips, (Tue Dec 14, 2:48 pm)
Re: [PATCH] bttv: fix mutex use before init, Dave Young, (Tue Dec 14, 7:42 pm)
Re: [PATCH] bttv: fix mutex use before init, Torsten Kaiser, (Tue Dec 14, 11:47 pm)
Re: [PATCH] bttv: fix mutex use before init, Chris Clayton, (Wed Dec 15, 11:44 am)
Re: [PATCH] bttv: fix mutex use before init, Mauro Carvalho Chehab, (Wed Dec 15, 2:45 pm)
Re: [PATCH] bttv: fix mutex use before init, Chris Clayton, (Thu Dec 16, 10:26 am)
Re: [PATCH] bttv: fix mutex use before init, Torsten Kaiser, (Fri Dec 17, 7:05 am)
Re: [PATCH] bttv: fix mutex use before init, Brandon Philips, (Fri Dec 17, 9:07 am)
Re: [PATCH] bttv: fix mutex use before init, Mauro Carvalho Chehab, (Fri Dec 17, 1:11 pm)