From 87a59ff0c409dc1e6900a1ca5f8b049a1a2e7739 Mon Sep 17 00:00:00 2001 From: Jean-Francois Moine Date: Sun, 24 Aug 2008 11:53:25 +0200 Subject: gspca: Fix problems with disabled controls. From: Hans de Goede Priority: high Signed-off-by: Hans de Goede Signed-off-by: Jean-Francois Moine --- linux/drivers/media/video/gspca/gspca.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'linux/drivers/media/video/gspca/gspca.c') 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); -- cgit v1.2.3