diff options
author | bphilips@suse.de <bphilips@suse.de> | 2007-09-27 20:55:28 -0300 |
---|---|---|
committer | bphilips@suse.de <bphilips@suse.de> | 2007-09-27 20:55:28 -0300 |
commit | b208f9186e3ac70ed274a7c93b27679d4a0aef4e (patch) | |
tree | bc634c306fd69306a5395fc88a4573e558654654 | |
parent | da0912de231d237e19473b5947af4df2463e385a (diff) | |
download | mediapointer-dvb-s2-b208f9186e3ac70ed274a7c93b27679d4a0aef4e.tar.gz mediapointer-dvb-s2-b208f9186e3ac70ed274a7c93b27679d4a0aef4e.tar.bz2 |
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 <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>
-rw-r--r-- | linux/drivers/media/video/videobuf-core.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/linux/drivers/media/video/videobuf-core.c b/linux/drivers/media/video/videobuf-core.c index aacced01e..4edb65114 100644 --- a/linux/drivers/media/video/videobuf-core.c +++ b/linux/drivers/media/video/videobuf-core.c @@ -290,16 +290,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; |