From: Brandon Philips Date: Tue, 22 Apr 2008 17:45:32 +0000 (-0300) Subject: V4L/DVB (7281): v4l: Deadlock in videobuf-core for DQBUF waiting on QBUF X-Git-Tag: v2.6.26-rc1~1084^2~379 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e43d76b40d3fda146b9cd1192c5504a257603b70;p=linux-2.6 V4L/DVB (7281): v4l: Deadlock in videobuf-core for DQBUF waiting on QBUF 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 . Signed-off-by: Brandon Philips Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/video/videobuf-core.c b/drivers/media/video/videobuf-core.c index eab79ffdf5..5ea635fac2 100644 --- a/drivers/media/video/videobuf-core.c +++ b/drivers/media/video/videobuf-core.c @@ -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;