From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from mail-in-12.arcor-online.net ([151.189.21.52]:44986 "EHLO mail-in-12.arcor-online.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752534AbZERDVE (ORCPT ); Sun, 17 May 2009 23:21:04 -0400 Subject: Re: [PATCH]saa7134-video.c: poll method lose race condition From: hermann pitton To: "figo.zhang" Cc: Mauro Carvalho Chehab , g.liakhovetski@gmx.de, linux-media@vger.kernel.org, figo1802@126.com, kraxel@bytesex.org, Hans Verkuil In-Reply-To: <1242612794.3442.19.camel@myhost> References: <1242612794.3442.19.camel@myhost> Content-Type: text/plain Date: Mon, 18 May 2009 05:07:55 +0200 Message-Id: <1242616075.3747.20.camel@pc07.localdom.local> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-media-owner@vger.kernel.org List-ID: Am Montag, den 18.05.2009, 10:13 +0800 schrieb figo.zhang: > saa7134-video.c: poll method lose race condition > > > Signed-off-by: Figo.zhang > --- > 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); > > 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