Skip to content

Commit 3616a46

Browse files
hverkuilgregkh
authored andcommitted
media: v4l2-ctrls.c/uvc: zero v4l2_event
commit f45f3f7 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: Hans Verkuil <[email protected]> Reported-by: [email protected] Reviewed-by: Laurent Pinchart <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 33fb499 commit 3616a46

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

drivers/media/usb/uvc/uvc_ctrl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1203,7 +1203,7 @@ static void uvc_ctrl_fill_event(struct uvc_video_chain *chain,
12031203

12041204
__uvc_query_v4l2_ctrl(chain, ctrl, mapping, &v4l2_ctrl);
12051205

1206-
memset(ev->reserved, 0, sizeof(ev->reserved));
1206+
memset(ev, 0, sizeof(*ev));
12071207
ev->type = V4L2_EVENT_CTRL;
12081208
ev->id = v4l2_ctrl.id;
12091209
ev->u.ctrl.value = value;

drivers/media/v4l2-core/v4l2-ctrls.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1239,7 +1239,7 @@ static u32 user_flags(const struct v4l2_ctrl *ctrl)
12391239

12401240
static void fill_event(struct v4l2_event *ev, struct v4l2_ctrl *ctrl, u32 changes)
12411241
{
1242-
memset(ev->reserved, 0, sizeof(ev->reserved));
1242+
memset(ev, 0, sizeof(*ev));
12431243
ev->type = V4L2_EVENT_CTRL;
12441244
ev->id = ctrl->id;
12451245
ev->u.ctrl.changes = changes;

0 commit comments

Comments
 (0)