Skip to content

Commit

Permalink
V4L/DVB (6276): V4L: videobuf-core.c lock before streaming check
Browse files Browse the repository at this point in the history
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 <bphilips@suse.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
http://thread.gmane.org/gmane.comp.video.video4linux/34978/focus=34981
Reviewed-by: Ricardo Cerqueira <v4l@cerqueira.org>
  • Loading branch information
Brandon Philips authored and Mauro Carvalho Chehab committed Oct 10, 2007
1 parent ba32bd9 commit 00f98d0
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions drivers/media/video/videobuf-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 00f98d0

Please sign in to comment.