Skip to content

Commit

Permalink
V4L/DVB: gspca - main: Check the file doing stream on/off
Browse files Browse the repository at this point in the history
Signed-off-by: Jean-François Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Jean-François Moine authored and Mauro Carvalho Chehab committed May 19, 2010
1 parent 0b62b73 commit 18bf99a
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions drivers/media/video/gspca/gspca.c
Original file line number Diff line number Diff line change
Expand Up @@ -1590,6 +1590,12 @@ static int vidioc_streamon(struct file *file, void *priv,
if (mutex_lock_interruptible(&gspca_dev->queue_lock))
return -ERESTARTSYS;

/* check the capture file */
if (gspca_dev->capt_file != file) {
ret = -EBUSY;
goto out;
}

if (gspca_dev->nframes == 0
|| !(gspca_dev->frame[0].v4l2_buf.flags & V4L2_BUF_FLAG_QUEUED)) {
ret = -EINVAL;
Expand Down Expand Up @@ -1627,6 +1633,12 @@ static int vidioc_streamoff(struct file *file, void *priv,
if (mutex_lock_interruptible(&gspca_dev->queue_lock))
return -ERESTARTSYS;

/* check the capture file */
if (gspca_dev->capt_file != file) {
ret = -EBUSY;
goto out;
}

/* stop streaming */
if (mutex_lock_interruptible(&gspca_dev->usb_lock)) {
ret = -ERESTARTSYS;
Expand Down

0 comments on commit 18bf99a

Please sign in to comment.