saa7134-video.c: poll method lose race condition
PATCH 1/1 saa7134-video.c: poll method lose race condition
saa7134-video.c: poll method lose race condition
---drivers/media/video/saa7134/saa7134-video.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
drivers/media/video/saa7134/saa7134-video.c +6 -3
@@ -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);
Am Montag, den 18.05.2009, 10:13 +0800 schrieb figo.zhang:
Quoted 36 lines
saa7134-video.c: poll method lose race conditionSigned-off-by Figo.zhang <[email protected]>---
drivers/media/video/saa7134/saa7134-video.c| 9 ++++++---1 files changed, 6 insertions(+), 3 deletions(-)drivers/media/video/saa7134/saa7134-video.c +3
-1@@ -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);
drivers/media/video/saa7134/saa7134-video.c video_poll(struct file *file, struct poll_table_struct *wait) · line 1461
Quoted 10 lines
drivers/media/video/saa7134/saa7134-video.c +3
-2if (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);
Can you please give some description on what your patch might do something?
Or are you a robot?
Then, please give us your serial number, production year, and when we can expect you are out of duty and replaced ;)
Cheers,
Hermann
Quoted 51 lines · hermann pitton
Am Montag, den 18.05.2009, 10:13 +0800 schrieb figo.zhang:
Quoted 36 lines
saa7134-video.c: poll method lose race conditionSigned-off-by Figo.zhang <[email protected]>---
drivers/media/video/saa7134/saa7134-video.c| 9 ++++++---1 files changed, 6 insertions(+), 3 deletions(-)drivers/media/video/saa7134/saa7134-video.c +3
-1@@ -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);drivers/media/video/saa7134/saa7134-video.c video_poll(struct file *file, struct poll_table_struct *wait) · line 1461
Quoted 10 lines
drivers/media/video/saa7134/saa7134-video.c +3
-2if (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);Can you please give some description on what your patch might do something?
Quoted 10 lines
Or are you a robot?
Then, please give us your serial number, production year, and when we can expect you are out of duty and replaced ;)
Cheers,
Hermann
hi, I just using the saa7134 chip to do a video capture card. The saa7134 driver in linux kernel, i found that the poll method have lose race condition for "RESOURCE_VIDEO". It have better to add a mutex lock.
Am Montag, den 18.05.2009, 11:53 +0800 schrieb figo.zhang:
Quoted 63 lines · hermann pitton
Quoted 51 lines
Am Montag, den 18.05.2009, 10:13 +0800 schrieb figo.zhang:
Quoted 36 lines
saa7134-video.c: poll method lose race conditionSigned-off-by Figo.zhang <[email protected]>---
drivers/media/video/saa7134/saa7134-video.c| 9 ++++++---1 files changed, 6 insertions(+), 3 deletions(-)drivers/media/video/saa7134/saa7134-video.c +3
-1@@ -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);drivers/media/video/saa7134/saa7134-video.c video_poll(struct file *file, struct poll_table_struct *wait) · line 1461
Quoted 10 lines
drivers/media/video/saa7134/saa7134-video.c +3
-2if (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);Can you please give some description on what your patch might do something?
Quoted 10 lines
Or are you a robot?
Then, please give us your serial number, production year, and when we can expect you are out of duty and replaced ;)
Cheers,
Hermann
Quoted 4 lines
hi, I just using the saa7134 chip to do a video capture card. The saa7134 driver in linux kernel, i found that the poll method have lose race condition for "
RESOURCE_VIDEO". It have better to add a mutex lock.
OK then, but better stay away from the core files.
On what kernel this is?
Give us some copy/paste "dmesg" output for your card with "i2c_scan=1". Don't lose tuner stuff on this.
Thanks,
Hermann
Quoted 71 lines · hermann pitton
Am Montag, den 18.05.2009, 11:53 +0800 schrieb figo.zhang:
Quoted 63 lines · hermann pitton
Quoted 51 lines
Am Montag, den 18.05.2009, 10:13 +0800 schrieb figo.zhang:
Quoted 36 lines
saa7134-video.c: poll method lose race conditionSigned-off-by Figo.zhang <[email protected]>---
drivers/media/video/saa7134/saa7134-video.c| 9 ++++++---1 files changed, 6 insertions(+), 3 deletions(-)drivers/media/video/saa7134/saa7134-video.c +3
-1@@ -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);drivers/media/video/saa7134/saa7134-video.c video_poll(struct file *file, struct poll_table_struct *wait) · line 1461
Quoted 10 lines
drivers/media/video/saa7134/saa7134-video.c +3
-2if (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);Can you please give some description on what your patch might do something?
Quoted 10 lines
Or are you a robot?
Then, please give us your serial number, production year, and when we can expect you are out of duty and replaced ;)
Cheers,
HermannQuoted 4 lines
hi, I just using the saa7134 chip to do a video capture card. The saa7134 driver in linux kernel, i found that the poll method have lose race condition for "
RESOURCE_VIDEO". It have better to add a mutex lock.OK then, but better stay away from the core files.
Quoted 10 lines
On what kernel this is?
Give us some copy/paste "dmesg" output for your card with "i2c_scan=1". Don't lose tuner stuff on this.
Thanks,
Hermann
hi, hermann pitton ,i am using the git-kernel, the card have some hardware problems now.
[big snip]
Quoted 5 lines
Quoted 3 lines
hi, hermann pitton ,i am using the git-kernel, the card have some hardware problems now.
If it is a new card, 2.6.27 is for sure the last stable.
We might get it all down, but 2.6.30 looked promising again.
Seems there is some hungry black hole in between ;)
Cheers,
Hermann
Quoted 4 lines · figo.zhang
saa7134-video.c: poll method lose race conditionSigned-off-by Figo.zhang <[email protected]>
Hi,
I am not sure why you decide to cc me on your sa7a34 patches. Those are not the kind of devices I'm working with, so, don't think I'll be able to help with your patches.
Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
Quoted 1 line · Guennadi Liakhovetski
Guennadi
hi,Guennadi,
I am sorry that it is my mistake.
Figo.zhang
Hi Figo Zhang,
Quoted 27 lines · figo.zhang
saa7134-video.c: poll method lose race conditionSigned-off-by Figo.zhang <[email protected]>---
drivers/media/video/saa7134/saa7134-video.c| 9 ++++++---1 files changed, 6 insertions(+), 3 deletions(-)(quoted diff) +0
-0
b/drivers/media/video/saa7134/saa7134-video.cindex 493cad9..95733df 100644drivers/media/video/saa7134/saa7134-video.c +2
-0@@ -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 {
drivers/media/video/saa7134/saa7134-video.c video_poll(struct file *file, struct · line 1451
Quoted 5 lines
drivers/media/video/saa7134/saa7134-video.c +1
-1@@ -1446,13 +1448,14 @@ video_poll(struct file *file, struct poll_table_struct *wait) }if (!buf) -return POLLERR ; + rc =POLLERR ;
Just one note (I don't know the future and meaning of this patch). The line above will change the meaning of the buf==NULL check. It will not return immediately, but call poll_wait with buf->done instead - NULL pointer access.
Cheers,
Oldrich.
Quoted 18 lines
drivers/media/video/saa7134/saa7134-video.c +3
-3poll_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); --To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html