Skip to content

Commit

Permalink
[media] v4l2-ctrls: fix missing 'read-only' check
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Hans Verkuil authored and Mauro Carvalho Chehab committed Jan 19, 2011
1 parent 4999e27 commit c959acf
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/media/video/v4l2-ctrls.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit c959acf

Please sign in to comment.