diff options
author | Brandon Philips <bphilips@suse.de> | 2007-09-28 01:55:28 +0200 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-10-10 05:03:05 +0200 |
commit | 00f98d0804c88c29bef81cb98c861f13c9b33f30 (patch) | |
tree | 0ca7f4b912e31f49fe342a29558d14b8cf2d395c | |
parent | V4L/DVB (6275): V4L: vivi.c remove the "resource" locking (diff) | |
download | linux-00f98d0804c88c29bef81cb98c861f13c9b33f30.tar.xz linux-00f98d0804c88c29bef81cb98c861f13c9b33f30.zip |
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 <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-- | drivers/media/video/videobuf-core.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/media/video/videobuf-core.c b/drivers/media/video/videobuf-core.c index a27e114cacef..ca67f80184bd 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; |