Browse Source

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 <hverkuil@xs4all.nl>.

Signed-off-by: Brandon Philips <bphilips@suse.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Brandon Philips 17 years ago
parent
commit
e43d76b40d
1 changed files with 2 additions and 0 deletions
  1. 2 0
      drivers/media/video/videobuf-core.c

+ 2 - 0
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;