From: "figo.zhang" <figo.zhang@kolorific.com>
To: Mauro Carvalho Chehab <mchehab@redhat.com>
Cc: g.liakhovetski@gmx.de, linux-media@vger.kernel.org,
figo1802@126.com, kraxel@bytesex.org,
Hans Verkuil <hverkuil@xs4all.nl>
Subject: [PATCH]saa7134-video.c: poll method lose race condition
Date: Mon, 18 May 2009 10:13:13 +0800 [thread overview]
Message-ID: <1242612794.3442.19.camel@myhost> (raw)
saa7134-video.c: poll method lose race condition
Signed-off-by: Figo.zhang <figo.zhang@kolorific.com>
---
drivers/media/video/saa7134/saa7134-video.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/media/video/saa7134/saa7134-video.c b/drivers/media/video/saa7134/saa7134-video.c
index 493cad9..95733df 100644
--- a/drivers/media/video/saa7134/saa7134-video.c
+++ b/drivers/media/video/saa7134/saa7134-video.c
@@ -1423,11 +1423,13 @@ video_poll(struct file *file, struct poll_table_struct *wait)
{
struct saa7134_fh *fh = file->private_data;
struct videobuf_buffer *buf = NULL;
+ unsigned int rc = 0;
if (V4L2_BUF_TYPE_VBI_CAPTURE == fh->type)
return videobuf_poll_stream(file, &fh->vbi, wait);
if (res_check(fh,RESOURCE_VIDEO)) {
+ mutex_lock(&fh->cap.vb_lock);
if (!list_empty(&fh->cap.stream))
buf = list_entry(fh->cap.stream.next, struct videobuf_buffer, stream);
} else {
@@ -1446,13 +1448,14 @@ video_poll(struct file *file, struct poll_table_struct *wait)
}
if (!buf)
- return POLLERR;
+ rc = POLLERR;
poll_wait(file, &buf->done, wait);
if (buf->state == VIDEOBUF_DONE ||
buf->state == VIDEOBUF_ERROR)
- return POLLIN|POLLRDNORM;
- return 0;
+ rc = POLLIN|POLLRDNORM;
+ mutex_unlock(&fh->cap.vb_lock);
+ return rc;
err:
mutex_unlock(&fh->cap.vb_lock);
next reply other threads:[~2009-05-18 2:13 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-18 2:13 figo.zhang [this message]
2009-05-18 3:07 ` [PATCH]saa7134-video.c: poll method lose race condition hermann pitton
2009-05-18 3:53 ` figo.zhang
2009-05-18 3:49 ` hermann pitton
2009-05-18 4:07 ` figo.zhang
2009-05-18 4:08 ` hermann pitton
2009-05-18 6:28 ` Guennadi Liakhovetski
2009-05-18 6:43 ` figo.zhang
2009-05-18 19:58 ` Oldřich Jedlička
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=1242612794.3442.19.camel@myhost \
--to=figo.zhang@kolorific.com \
--cc=figo1802@126.com \
--cc=g.liakhovetski@gmx.de \
--cc=hverkuil@xs4all.nl \
--cc=kraxel@bytesex.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@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