Commit 0f523c2f authored by Hans de Goede's avatar Hans de Goede Committed by Mauro Carvalho Chehab

V4L/DVB (8815): gspca: Fix problems with disabled controls.

Signed-off-by: default avatarHans de Goede <j.w.r.degoede@hhs.nl>
Signed-off-by: default avatarJean-Francois Moine <moinejf@free.fr>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent f50ba1be
...@@ -869,7 +869,7 @@ static int vidioc_queryctrl(struct file *file, void *priv, ...@@ -869,7 +869,7 @@ static int vidioc_queryctrl(struct file *file, void *priv,
id &= V4L2_CTRL_ID_MASK; id &= V4L2_CTRL_ID_MASK;
id++; id++;
for (i = 0; i < gspca_dev->sd_desc->nctrls; i++) { for (i = 0; i < gspca_dev->sd_desc->nctrls; i++) {
if (id < gspca_dev->sd_desc->ctrls[i].qctrl.id) if (gspca_dev->sd_desc->ctrls[i].qctrl.id < id)
continue; continue;
if (ix < 0) { if (ix < 0) {
ix = i; ix = i;
...@@ -908,6 +908,8 @@ static int vidioc_s_ctrl(struct file *file, void *priv, ...@@ -908,6 +908,8 @@ static int vidioc_s_ctrl(struct file *file, void *priv,
i++, ctrls++) { i++, ctrls++) {
if (ctrl->id != ctrls->qctrl.id) if (ctrl->id != ctrls->qctrl.id)
continue; continue;
if (gspca_dev->ctrl_dis & (1 << i))
return -EINVAL;
if (ctrl->value < ctrls->qctrl.minimum if (ctrl->value < ctrls->qctrl.minimum
|| ctrl->value > ctrls->qctrl.maximum) || ctrl->value > ctrls->qctrl.maximum)
return -ERANGE; return -ERANGE;
...@@ -934,6 +936,8 @@ static int vidioc_g_ctrl(struct file *file, void *priv, ...@@ -934,6 +936,8 @@ static int vidioc_g_ctrl(struct file *file, void *priv,
i++, ctrls++) { i++, ctrls++) {
if (ctrl->id != ctrls->qctrl.id) if (ctrl->id != ctrls->qctrl.id)
continue; continue;
if (gspca_dev->ctrl_dis & (1 << i))
return -EINVAL;
if (mutex_lock_interruptible(&gspca_dev->usb_lock)) if (mutex_lock_interruptible(&gspca_dev->usb_lock))
return -ERESTARTSYS; return -ERESTARTSYS;
ret = ctrls->get(gspca_dev, &ctrl->value); ret = ctrls->get(gspca_dev, &ctrl->value);
......
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