提交 18bf99aa 编写于 作者: J Jean-François Moine 提交者: Mauro Carvalho Chehab

V4L/DVB: gspca - main: Check the file doing stream on/off

Signed-off-by: NJean-François Moine <moinejf@free.fr>
Signed-off-by: NMauro Carvalho Chehab <mchehab@redhat.com>
上级 0b62b737
......@@ -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;
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册