From 50078bb28b21b2ffb6ddd69c02a97cf2762661ec Mon Sep 17 00:00:00 2001 From: Brandon Philips Date: Tue, 26 Feb 2008 23:52:55 -0800 Subject: 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 . From: Brandon Philips Signed-off-by: Brandon Philips --- linux/drivers/media/video/videobuf-core.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/linux/drivers/media/video/videobuf-core.c b/linux/drivers/media/video/videobuf-core.c index b5395c538..86f32545c 100644 --- a/linux/drivers/media/video/videobuf-core.c +++ b/linux/drivers/media/video/videobuf-core.c @@ -606,7 +606,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; -- cgit v1.2.3