aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAidan Thornton <makosoft@googlemail.com>2008-04-13 15:02:24 -0300
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-04-24 14:08:48 -0300
commit0ea13e6e59853cab9e8ed3ac231ec5d44d8386a6 (patch)
tree5d9fcef7a7394e753a76955c1c64c3947b1d5ee2
parentb957dfdc3161d00b01b52154eb2d53580c8911e5 (diff)
V4L/DVB (7556): em28xx: fix locking on vidioc_s_fmt_cap
Currently, vidioc_s_fmt_cap is allowed even if streaming is running on some other fh. This is likely to cause issues. Block use of vidioc_s_fmt_cap if someone else has claimed access to the device. Signed-off-by: Aidan Thornton <makosoft@googlemail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
-rw-r--r--drivers/media/video/em28xx/em28xx-video.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c
index d6ada6226b5..d3485f500c5 100644
--- a/drivers/media/video/em28xx/em28xx-video.c
+++ b/drivers/media/video/em28xx/em28xx-video.c
@@ -947,6 +947,12 @@ static int vidioc_s_fmt_cap(struct file *file, void *priv,
goto out;
}
+ if (dev->stream_on && !fh->stream_on) {
+ em28xx_errdev("%s device in use by another fh\n", __func__);
+ rc = -EBUSY;
+ goto out;
+ }
+
/* set new image size */
dev->width = f->fmt.pix.width;
dev->height = f->fmt.pix.height;