From: Brandon Philips Date: Thu, 27 Sep 2007 23:55:28 +0000 (-0300) Subject: V4L/DVB (6276): V4L: videobuf-core.c lock before streaming check X-Git-Tag: v2.6.24-rc1~1463^2~29 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=00f98d0804c88c29bef81cb98c861f13c9b33f30;p=linux-2.6-omap-h63xx.git V4L/DVB (6276): V4L: videobuf-core.c lock before streaming check The reading/streaming fields are used for mutual exclusion of the queue and should be protected by the queue lock. Signed-off-by: Brandon Philips Signed-off-by: Mauro Carvalho Chehab http://thread.gmane.org/gmane.comp.video.video4linux/34978/focus=34981 Reviewed-by: Ricardo Cerqueira --- diff --git a/drivers/media/video/videobuf-core.c b/drivers/media/video/videobuf-core.c index a27e114cace..ca67f80184b 100644 --- a/drivers/media/video/videobuf-core.c +++ b/drivers/media/video/videobuf-core.c @@ -289,16 +289,18 @@ int videobuf_reqbufs(struct videobuf_queue *q, return -EINVAL; } + mutex_lock(&q->lock); if (q->streaming) { dprintk(1,"reqbufs: streaming already exists\n"); - return -EBUSY; + retval = -EBUSY; + goto done; } if (!list_empty(&q->stream)) { dprintk(1,"reqbufs: stream running\n"); - return -EBUSY; + retval = -EBUSY; + goto done; } - mutex_lock(&q->lock); count = req->count; if (count > VIDEO_MAX_FRAME) count = VIDEO_MAX_FRAME;