Commit 0ea13e6e authored by Aidan Thornton's avatar Aidan Thornton Committed by Mauro Carvalho Chehab

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: default avatarAidan Thornton <makosoft@googlemail.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent b957dfdc
...@@ -947,6 +947,12 @@ static int vidioc_s_fmt_cap(struct file *file, void *priv, ...@@ -947,6 +947,12 @@ static int vidioc_s_fmt_cap(struct file *file, void *priv,
goto out; 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 */ /* set new image size */
dev->width = f->fmt.pix.width; dev->width = f->fmt.pix.width;
dev->height = f->fmt.pix.height; dev->height = f->fmt.pix.height;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment