Commit 00f98d08 authored by Brandon Philips's avatar Brandon Philips Committed by Mauro Carvalho Chehab

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: default avatarBrandon Philips <bphilips@suse.de>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
http://thread.gmane.org/gmane.comp.video.video4linux/34978/focus=34981Reviewed-by: default avatarRicardo Cerqueira <v4l@cerqueira.org>
parent ba32bd95
...@@ -289,16 +289,18 @@ int videobuf_reqbufs(struct videobuf_queue *q, ...@@ -289,16 +289,18 @@ int videobuf_reqbufs(struct videobuf_queue *q,
return -EINVAL; return -EINVAL;
} }
mutex_lock(&q->lock);
if (q->streaming) { if (q->streaming) {
dprintk(1,"reqbufs: streaming already exists\n"); dprintk(1,"reqbufs: streaming already exists\n");
return -EBUSY; retval = -EBUSY;
goto done;
} }
if (!list_empty(&q->stream)) { if (!list_empty(&q->stream)) {
dprintk(1,"reqbufs: stream running\n"); dprintk(1,"reqbufs: stream running\n");
return -EBUSY; retval = -EBUSY;
goto done;
} }
mutex_lock(&q->lock);
count = req->count; count = req->count;
if (count > VIDEO_MAX_FRAME) if (count > VIDEO_MAX_FRAME)
count = VIDEO_MAX_FRAME; count = VIDEO_MAX_FRAME;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment