From: Mauro Carvalho Chehab <mchehab@infradead.org>
To: Brandon Philips <brandon@ifup.org>
Cc: video4linux-list@redhat.com, v4l-dvb-maintainer@linuxtv.org,
Jonathan Corbet <corbet@lwn.net>
Subject: Re: [PATCH] v4l: Deadlock in videobuf-core for DQBUF waiting on QBUF
Date: Fri, 29 Feb 2008 06:34:58 -0300 [thread overview]
Message-ID: <20080229063458.0f49ddb0@areia> (raw)
In-Reply-To: <20080228025651.GA16322@plankton.ifup.org>
On Wed, 27 Feb 2008 18:56:51 -0800
Brandon Philips <brandon@ifup.org> wrote:
> On 09:08 Wed 27 Feb 2008, Jonathan Corbet wrote:
> > Brandon Philips <brandon@ifup.org> wrote:
> >
> > > 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);
> >
> > Are you sure that this doesn't create a race where two threads could end
> > up waiting on the same buf?
>
> You are right... I thought I had thought through this but a race can be
> created with two threads doing DQBUF.
>
> > Actually, almost anything could happen to buf by the time you've
> > gotten the mutex back - it might not even exist anymore - but there
> > are no checks for that. It seems like a better fix might be to set
> > nonblocking unconditionally to 1 for the videobuf_waiton() call, then
> > start over from the beginning on a -EAGAIN return (if the caller has
> > not requested nonblocking behavior).
>
> Hrm, that is one solution. I will think about it for a bit and submit a
> new patch.
>
> Thanks for catching this, I was being stupid.
>
> Mauro: Please don't push this patch out. Thanks.
The patch were already applied at the staging tree. I'll keep it there until we
have a definitive solution. After that, the better would be to fold the both
patches and send to 2.6.25-rc.
Cheers,
Mauro
--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list
next prev parent reply other threads:[~2008-02-29 10:02 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-27 7:54 [PATCH] v4l: Deadlock in videobuf-core for DQBUF waiting on QBUF Brandon Philips
2008-02-27 20:09 ` [v4l-dvb-maintainer] " Trent Piepho
[not found] ` <20679.1204128530@vena.lwn.net>
2008-02-28 2:56 ` Brandon Philips
2008-02-29 9:34 ` Mauro Carvalho Chehab [this message]
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=20080229063458.0f49ddb0@areia \
--to=mchehab@infradead.org \
--cc=brandon@ifup.org \
--cc=corbet@lwn.net \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.