diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2011-01-16 09:03:28 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-01-19 08:46:14 -0500 |
commit | c959acfddb3d24ecfdae1a280a7a1785d9df81d1 (patch) | |
tree | b8ead8b3c9e3720c0bbcabaa06f68c85805c219e /drivers | |
parent | 4999e27a62eaf28e88bc69ab8cf11697e0dda261 (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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/video/v4l2-ctrls.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/media/video/v4l2-ctrls.c b/drivers/media/video/v4l2-ctrls.c index 0d1a3d831374..22a9a722f520 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) | |||
1824 | int ret; | 1824 | int ret; |
1825 | int i; | 1825 | int i; |
1826 | 1826 | ||
1827 | if (ctrl->flags & V4L2_CTRL_FLAG_READ_ONLY) | ||
1828 | return -EACCES; | ||
1829 | |||
1827 | v4l2_ctrl_lock(ctrl); | 1830 | v4l2_ctrl_lock(ctrl); |
1828 | 1831 | ||
1829 | /* Reset the 'is_new' flags of the cluster */ | 1832 | /* Reset the 'is_new' flags of the cluster */ |