From: Dan Carpenter <error27@gmail.com>
To: Sergej Pupykin <pupykin.s@gmail.com>
Cc: Mauro Carvalho Chehab <mchehab@infradead.org>,
linux-media@vger.kernel.org
Subject: [patch v2] [media] bttv: take correct lock in bttv_open()
Date: Sun, 12 Dec 2010 19:58:12 +0300 [thread overview]
Message-ID: <20101212165812.GG10623@bicker> (raw)
In-Reply-To: <4D01D4BE.1080000@gmail.com>
We're trying to make sure that no one is writing to the btv->init struct
while we copy it over to the newly allocated "fh" struct. The original
code doesn't make sense because "fh->cap.vb_lock" hasn't been
initialized and no one else can be writing to it anyway.
Addresses: https://bugzilla.kernel.org/show_bug.cgi?id=24602
Signed-off-by: Dan Carpenter <error27@gmail.com>
---
Sergej could you test this one?
diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c
index a529619..6c8f4b0 100644
--- a/drivers/media/video/bt8xx/bttv-driver.c
+++ b/drivers/media/video/bt8xx/bttv-driver.c
@@ -3302,9 +3302,9 @@ static int bttv_open(struct file *file)
* Let's first copy btv->init at fh, holding cap.vb_lock, and then work
* with the rest of init, holding btv->lock.
*/
- mutex_lock(&fh->cap.vb_lock);
+ mutex_lock(&btv->init.cap.vb_lock);
*fh = btv->init;
- mutex_unlock(&fh->cap.vb_lock);
+ mutex_unlock(&btv->init.cap.vb_lock);
fh->type = type;
fh->ov.setup_ok = 0;
next parent reply other threads:[~2010-12-12 16:58 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20101210033304.GX10623@bicker>
[not found] ` <4D01D4BE.1080000@gmail.com>
2010-12-12 16:58 ` Dan Carpenter [this message]
2010-12-12 22:42 ` [patch v2] [media] bttv: take correct lock in bttv_open() Sergej Pupykin
2010-12-14 10:36 ` Dan Carpenter
2010-12-14 12:33 ` Mauro Carvalho Chehab
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20101212165812.GG10623@bicker \
--to=error27@gmail.com \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@infradead.org \
--cc=pupykin.s@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox