]> git.karo-electronics.de Git - linux-beck.git/commitdiff
[media] v4l2-ctrls: fix missing 'read-only' check
authorHans Verkuil <hverkuil@xs4all.nl>
Sun, 16 Jan 2011 14:03:28 +0000 (11:03 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Wed, 19 Jan 2011 13:46:14 +0000 (11:46 -0200)
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>
drivers/media/video/v4l2-ctrls.c

index 0d1a3d831374e7e2dbd031b36ef6e29f5f555694..22a9a722f520e73f34532c1107ccb56da9edcc4c 100644 (file)
@@ -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 */