aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2011-01-16 14:03:28 (GMT)
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-01-17 13:49:33 (GMT)
commitf9f172cb7517cdf30b009bca63d200ef13dafdd7 (patch)
tree69d68e3efde8fe1dbd3239121b0deebfa66e112e
parentc9cdb7e69d0eba0d2ba9f88af93834de84318e32 (diff)
[media] v4l2-ctrls: fix missing 'read-only' check
VIDIOC_S_CTRL did not check against read-only controls. Even worse, for controls of type CTRL_CLASS it would cause a kernel oops since those controls do not have a s_ctrl op. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--drivers/media/video/v4l2-ctrls.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/media/video/v4l2-ctrls.c b/drivers/media/video/v4l2-ctrls.c
index 0d1a3d8..22a9a72 100644
--- a/drivers/media/video/v4l2-ctrls.c
+++ b/drivers/media/video/v4l2-ctrls.c
@@ -1824,6 +1824,9 @@ static int set_ctrl(struct v4l2_ctrl *ctrl, s32 *val)
int ret;
int i;
+ if (ctrl->flags & V4L2_CTRL_FLAG_READ_ONLY)
+ return -EACCES;
+
v4l2_ctrl_lock(ctrl);
/* Reset the 'is_new' flags of the cluster */

Privacy Policy