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 <erro...@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;
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to