From c959acfddb3d24ecfdae1a280a7a1785d9df81d1 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Sun, 16 Jan 2011 11:03:28 -0300 Subject: [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 Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/v4l2-ctrls.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/media/video/v4l2-ctrls.c b/drivers/media/video/v4l2-ctrls.c index 0d1a3d83137..22a9a722f52 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 */ -- cgit v1.2.3-18-g5258