diff options
author | Figo.zhang <figo1802@gmail.com> | 2009-06-16 13:31:29 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-06-16 19:14:44 -0300 |
commit | 9fd6418a6a7655b69cfa0ae27a3639a6d0b2924f (patch) | |
tree | 3b3754a6518f7cefb130b314199733daaf831d2b /drivers/media/video/bt8xx/bttv-driver.c | |
parent | 1c905a4522a3913cf321365c5bb62eb2f70d55d9 (diff) | |
download | kernel_samsung_smdk4412-9fd6418a6a7655b69cfa0ae27a3639a6d0b2924f.zip kernel_samsung_smdk4412-9fd6418a6a7655b69cfa0ae27a3639a6d0b2924f.tar.gz kernel_samsung_smdk4412-9fd6418a6a7655b69cfa0ae27a3639a6d0b2924f.tar.bz2 |
V4L/DVB (12004): poll method lose race condition
bttv-driver.c,cx23885-video.c,cx88-video.c: poll method lose race condition for capture video.
Signed-off-by: Figo.zhang <figo1802@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/bt8xx/bttv-driver.c')
-rw-r--r-- | drivers/media/video/bt8xx/bttv-driver.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c index 7c1f826..5eb1464 100644 --- a/drivers/media/video/bt8xx/bttv-driver.c +++ b/drivers/media/video/bt8xx/bttv-driver.c @@ -3152,6 +3152,7 @@ static unsigned int bttv_poll(struct file *file, poll_table *wait) struct bttv_fh *fh = file->private_data; struct bttv_buffer *buf; enum v4l2_field field; + unsigned int rc = POLLERR; if (V4L2_BUF_TYPE_VBI_CAPTURE == fh->type) { if (!check_alloc_btres(fh->btv,fh,RESOURCE_VBI)) @@ -3160,9 +3161,10 @@ static unsigned int bttv_poll(struct file *file, poll_table *wait) } if (check_btres(fh,RESOURCE_VIDEO_STREAM)) { + mutex_lock(&fh->cap.vb_lock); /* streaming capture */ if (list_empty(&fh->cap.stream)) - return POLLERR; + goto err; buf = list_entry(fh->cap.stream.next,struct bttv_buffer,vb.stream); } else { /* read() capture */ @@ -3191,11 +3193,12 @@ static unsigned int bttv_poll(struct file *file, poll_table *wait) poll_wait(file, &buf->vb.done, wait); if (buf->vb.state == VIDEOBUF_DONE || buf->vb.state == VIDEOBUF_ERROR) - return POLLIN|POLLRDNORM; - return 0; + rc = POLLIN|POLLRDNORM; + else + rc = 0; err: mutex_unlock(&fh->cap.vb_lock); - return POLLERR; + return rc; } static int bttv_open(struct file *file) |