public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Brandon Philips <brandon@ifup.org>
To: mchehab@infradead.org
Cc: video4linux-list@redhat.com, v4l-dvb-maintainer@linuxtv.org
Subject: [PATCH] v4l: Deadlock in videobuf-core for DQBUF waiting on QBUF
Date: Tue, 26 Feb 2008 23:54:41 -0800	[thread overview]
Message-ID: <54fa1a0d9c5bcdfcb2ba.1204098881@localhost> (raw)

# HG changeset patch
# User Brandon Philips <brandon@ifup.org>
# 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@xs4all.nl>.

Signed-off-by: Brandon Philips <bphilips@suse.de>

---
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@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

             reply	other threads:[~2008-02-27  8:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-27  7:54 Brandon Philips [this message]
2008-02-27 20:09 ` [v4l-dvb-maintainer] [PATCH] v4l: Deadlock in videobuf-core for DQBUF waiting on QBUF Trent Piepho
     [not found] ` <20679.1204128530@vena.lwn.net>
2008-02-28  2:56   ` Brandon Philips
2008-02-29  9:34     ` Mauro Carvalho Chehab
2008-03-03  8:13       ` Brandon Philips
2008-03-04 13:45         ` Mauro Carvalho Chehab
2008-03-04 20:14           ` Brandon Philips

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54fa1a0d9c5bcdfcb2ba.1204098881@localhost \
    --to=brandon@ifup.org \
    --cc=mchehab@infradead.org \
    --cc=v4l-dvb-maintainer@linuxtv.org \
    --cc=video4linux-list@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox