Skip to content

Commit f45f3f7

Browse files
hverkuilmchehab
authored andcommitted
media: v4l2-ctrls.c/uvc: zero v4l2_event
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]>
1 parent 2a850b9 commit f45f3f7

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
@@ -1212,7 +1212,7 @@ static void uvc_ctrl_fill_event(struct uvc_video_chain *chain,
12121212

12131213
__uvc_query_v4l2_ctrl(chain, ctrl, mapping, &v4l2_ctrl);
12141214

1215-
memset(ev->reserved, 0, sizeof(ev->reserved));
1215+
memset(ev, 0, sizeof(*ev));
12161216
ev->type = V4L2_EVENT_CTRL;
12171217
ev->id = v4l2_ctrl.id;
12181218
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
@@ -1387,7 +1387,7 @@ static u32 user_flags(const struct v4l2_ctrl *ctrl)
13871387

13881388
static void fill_event(struct v4l2_event *ev, struct v4l2_ctrl *ctrl, u32 changes)
13891389
{
1390-
memset(ev->reserved, 0, sizeof(ev->reserved));
1390+
memset(ev, 0, sizeof(*ev));
13911391
ev->type = V4L2_EVENT_CTRL;
13921392
ev->id = ctrl->id;
13931393
ev->u.ctrl.changes = changes;

0 commit comments

Comments
 (0)