Commit 3616a46e authored by Hans Verkuil's avatar Hans Verkuil Committed by Greg Kroah-Hartman

media: v4l2-ctrls.c/uvc: zero v4l2_event

commit f45f3f75 upstream.

Control events can leak kernel memory since they do not fully zero the
event. The same code is present in both v4l2-ctrls.c and uvc_ctrl.c, so
fix both.

It appears that all other event code is properly zeroing the structure,
it's these two places.
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Reported-by: syzbot+4f021cf3697781dbd9fb@syzkaller.appspotmail.com
Reviewed-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 33fb4996
...@@ -1203,7 +1203,7 @@ static void uvc_ctrl_fill_event(struct uvc_video_chain *chain, ...@@ -1203,7 +1203,7 @@ static void uvc_ctrl_fill_event(struct uvc_video_chain *chain,
__uvc_query_v4l2_ctrl(chain, ctrl, mapping, &v4l2_ctrl); __uvc_query_v4l2_ctrl(chain, ctrl, mapping, &v4l2_ctrl);
memset(ev->reserved, 0, sizeof(ev->reserved)); memset(ev, 0, sizeof(*ev));
ev->type = V4L2_EVENT_CTRL; ev->type = V4L2_EVENT_CTRL;
ev->id = v4l2_ctrl.id; ev->id = v4l2_ctrl.id;
ev->u.ctrl.value = value; ev->u.ctrl.value = value;
......
...@@ -1239,7 +1239,7 @@ static u32 user_flags(const struct v4l2_ctrl *ctrl) ...@@ -1239,7 +1239,7 @@ static u32 user_flags(const struct v4l2_ctrl *ctrl)
static void fill_event(struct v4l2_event *ev, struct v4l2_ctrl *ctrl, u32 changes) static void fill_event(struct v4l2_event *ev, struct v4l2_ctrl *ctrl, u32 changes)
{ {
memset(ev->reserved, 0, sizeof(ev->reserved)); memset(ev, 0, sizeof(*ev));
ev->type = V4L2_EVENT_CTRL; ev->type = V4L2_EVENT_CTRL;
ev->id = ctrl->id; ev->id = ctrl->id;
ev->u.ctrl.changes = changes; ev->u.ctrl.changes = changes;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment