Skip to content

Commit

Permalink
V4L/DVB (7556): em28xx: fix locking on vidioc_s_fmt_cap
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Aidan Thornton authored and Mauro Carvalho Chehab committed Apr 24, 2008
1 parent b957dfd commit 0ea13e6
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drivers/media/video/em28xx/em28xx-video.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 0ea13e6

Please sign in to comment.