summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/gspca/gspca.c
diff options
context:
space:
mode:
authorJean-Francois Moine <moinejf@free.fr>2008-08-24 11:53:25 +0200
committerJean-Francois Moine <moinejf@free.fr>2008-08-24 11:53:25 +0200
commit87a59ff0c409dc1e6900a1ca5f8b049a1a2e7739 (patch)
tree2618a08a1397924812788beca8c8433004fcfdeb /linux/drivers/media/video/gspca/gspca.c
parent02f9092857f057050d3b357e37e446b28d39d307 (diff)
downloadmediapointer-dvb-s2-87a59ff0c409dc1e6900a1ca5f8b049a1a2e7739.tar.gz
mediapointer-dvb-s2-87a59ff0c409dc1e6900a1ca5f8b049a1a2e7739.tar.bz2
gspca: Fix problems with disabled controls.
From: Hans de Goede <j.w.r.degoede@hhs.nl> Priority: high Signed-off-by: Hans de Goede <j.w.r.degoede@hhs.nl> Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
Diffstat (limited to 'linux/drivers/media/video/gspca/gspca.c')
-rw-r--r--linux/drivers/media/video/gspca/gspca.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/linux/drivers/media/video/gspca/gspca.c b/linux/drivers/media/video/gspca/gspca.c
index 1ab2e3968..716a01446 100644
--- a/linux/drivers/media/video/gspca/gspca.c
+++ b/linux/drivers/media/video/gspca/gspca.c
@@ -876,7 +876,7 @@ static int vidioc_queryctrl(struct file *file, void *priv,
id &= V4L2_CTRL_ID_MASK;
id++;
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;
if (ix < 0) {
ix = i;
@@ -915,6 +915,8 @@ static int vidioc_s_ctrl(struct file *file, void *priv,
i++, ctrls++) {
if (ctrl->id != ctrls->qctrl.id)
continue;
+ if (gspca_dev->ctrl_dis & (1 << i))
+ return -EINVAL;
if (ctrl->value < ctrls->qctrl.minimum
|| ctrl->value > ctrls->qctrl.maximum)
return -ERANGE;
@@ -941,6 +943,8 @@ static int vidioc_g_ctrl(struct file *file, void *priv,
i++, ctrls++) {
if (ctrl->id != ctrls->qctrl.id)
continue;
+ if (gspca_dev->ctrl_dis & (1 << i))
+ return -EINVAL;
if (mutex_lock_interruptible(&gspca_dev->usb_lock))
return -ERESTARTSYS;
ret = ctrls->get(gspca_dev, &ctrl->value);