]> err.no Git - linux-2.6/commitdiff
V4L/DVB (7281): v4l: Deadlock in videobuf-core for DQBUF waiting on QBUF
authorBrandon Philips <brandon@ifup.org>
Tue, 22 Apr 2008 17:45:32 +0000 (14:45 -0300)
committerMauro Carvalho Chehab <mchehab@infradead.org>
Thu, 24 Apr 2008 17:07:46 +0000 (14:07 -0300)
Avoid a deadlock where DQBUF is holding the vb_lock while waiting on a QBUF
which also needs the vb_lock.  Reported by Hans Verkuil <hverkuil@xs4all.nl>.

Signed-off-by: Brandon Philips <bphilips@suse.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
drivers/media/video/videobuf-core.c

index eab79ffdf56a882529113c0e25623d0c5941ab1c..5ea635fac2364eefdf7e77891994b594aec2acec 100644 (file)
@@ -605,7 +605,9 @@ int videobuf_dqbuf(struct videobuf_queue *q,
                goto done;
        }
        buf = list_entry(q->stream.next, struct videobuf_buffer, stream);
+       mutex_unlock(&q->vb_lock);
        retval = videobuf_waiton(buf, nonblocking, 1);
+       mutex_lock(&q->vb_lock);
        if (retval < 0) {
                dprintk(1, "dqbuf: waiton returned %d\n", retval);
                goto done;