Web lists-archives.org

[PATCH] v4l: Deadlock in videobuf-core for DQBUF waiting on QBUF




# HG changeset patch
# User Brandon Philips <brandon@xxxxxxxx>
# Date 1204098775 28800
# Node ID 54fa1a0d9c5bcdfcb2ba70be2fc68d51a1ab7b9c
# Parent  9756fb75295872570d1fa49b4bcf5d0967ecedaa
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 <hverkuil@xxxxxxxxx>.

Signed-off-by: Brandon Philips <bphilips@xxxxxxx>

---
Pull from: http://ifup.org/hg/v4l-dvb

Should be merged for 2.6.25

diff --git a/linux/drivers/media/video/videobuf-core.c b/linux/drivers/media/video/videobuf-core.c
--- 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
 		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;


--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list