From e43d76b40d3fda146b9cd1192c5504a257603b70 Mon Sep 17 00:00:00 2001 From: Brandon Philips Date: Tue, 22 Apr 2008 14:45:32 -0300 Subject: [PATCH] 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 --- drivers/media/video/videobuf-core.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/media/video/videobuf-core.c b/drivers/media/video/videobuf-core.c index eab79ffdf56a..5ea635fac236 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; -- 2.20.1