From: Aidan Thornton Date: Sun, 13 Apr 2008 18:02:24 +0000 (-0300) Subject: V4L/DVB (7556): em28xx: fix locking on vidioc_s_fmt_cap X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=0ea13e6e59853cab9e8ed3ac231ec5d44d8386a6;p=linux-beck.git 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 Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c index d6ada6226b54..d3485f500c5e 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;