diff options
author | figo.zhang <figo.zhang@kolorific.com> | 2009-05-17 22:13:13 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-06-16 17:21:12 -0400 |
commit | 4a567394dce57e8a2329f0a1123b951b0f070d39 (patch) | |
tree | 7ad9e01331d85375397dbdf2fc8a51e5d1788e9b /drivers/media/video/saa7134/saa7134-video.c | |
parent | 7d8535329c4e620c155895a33e1bcc47239858b8 (diff) |
V4L/DVB (11852): saa7134-video.c: poll method lose race condition
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 'drivers/media/video/saa7134/saa7134-video.c')
-rw-r--r-- | 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 493cad941460..ceae3c88f93e 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) | |||
1423 | { | 1423 | { |
1424 | struct saa7134_fh *fh = file->private_data; | 1424 | struct saa7134_fh *fh = file->private_data; |
1425 | struct videobuf_buffer *buf = NULL; | 1425 | struct videobuf_buffer *buf = NULL; |
1426 | unsigned int rc = 0; | ||
1426 | 1427 | ||
1427 | if (V4L2_BUF_TYPE_VBI_CAPTURE == fh->type) | 1428 | if (V4L2_BUF_TYPE_VBI_CAPTURE == fh->type) |
1428 | return videobuf_poll_stream(file, &fh->vbi, wait); | 1429 | return videobuf_poll_stream(file, &fh->vbi, wait); |
1429 | 1430 | ||
1430 | if (res_check(fh,RESOURCE_VIDEO)) { | 1431 | if (res_check(fh,RESOURCE_VIDEO)) { |
1432 | mutex_lock(&fh->cap.vb_lock); | ||
1431 | if (!list_empty(&fh->cap.stream)) | 1433 | if (!list_empty(&fh->cap.stream)) |
1432 | buf = list_entry(fh->cap.stream.next, struct videobuf_buffer, stream); | 1434 | buf = list_entry(fh->cap.stream.next, struct videobuf_buffer, stream); |
1433 | } else { | 1435 | } else { |
@@ -1446,13 +1448,14 @@ video_poll(struct file *file, struct poll_table_struct *wait) | |||
1446 | } | 1448 | } |
1447 | 1449 | ||
1448 | if (!buf) | 1450 | if (!buf) |
1449 | return POLLERR; | 1451 | goto err; |
1450 | 1452 | ||
1451 | poll_wait(file, &buf->done, wait); | 1453 | poll_wait(file, &buf->done, wait); |
1452 | if (buf->state == VIDEOBUF_DONE || | 1454 | if (buf->state == VIDEOBUF_DONE || |
1453 | buf->state == VIDEOBUF_ERROR) | 1455 | buf->state == VIDEOBUF_ERROR) |
1454 | return POLLIN|POLLRDNORM; | 1456 | rc = POLLIN|POLLRDNORM; |
1455 | return 0; | 1457 | mutex_unlock(&fh->cap.vb_lock); |
1458 | return rc; | ||
1456 | 1459 | ||
1457 | err: | 1460 | err: |
1458 | mutex_unlock(&fh->cap.vb_lock); | 1461 | mutex_unlock(&fh->cap.vb_lock); |