summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/saa7134
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2009-05-18 02:13:13 +0000
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-05-18 02:13:13 +0000
commit713eb7e466a32a7c315c799beb83a9d6c51e0e03 (patch)
tree84d24259177aea14a10d1950a0feb6108badb0ec /linux/drivers/media/video/saa7134
parent67244363bf89cf9f2e5669d2ec3c582cd07a321c (diff)
downloadmediapointer-dvb-s2-713eb7e466a32a7c315c799beb83a9d6c51e0e03.tar.gz
mediapointer-dvb-s2-713eb7e466a32a7c315c799beb83a9d6c51e0e03.tar.bz2
saa7134-video.c: poll method lose race condition
From: figo.zhang <figo.zhang@kolorific.com> saa7134-video.c: poll method lose race condition Signed-off-by: Figo.zhang <figo.zhang@kolorific.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'linux/drivers/media/video/saa7134')
-rw-r--r--linux/drivers/media/video/saa7134/saa7134-video.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/linux/drivers/media/video/saa7134/saa7134-video.c b/linux/drivers/media/video/saa7134/saa7134-video.c
index 5f68bed54..26f1727e6 100644
--- a/linux/drivers/media/video/saa7134/saa7134-video.c
+++ b/linux/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);