diff mbox series

[for,5.18] v4l2-compat-ioctl32.c: zero buffer passed to v4l2_compat_get_array_args()

Message ID b80719f3-cff2-89f2-3ad1-d8e708808dbd@xs4all.nl
State New
Headers show
Series [for,5.18] v4l2-compat-ioctl32.c: zero buffer passed to v4l2_compat_get_array_args() | expand

Commit Message

Hans Verkuil March 21, 2022, 8:33 a.m. UTC
The v4l2_compat_get_array_args() function can leave uninitialized memory in the
buffer it is passed. So zero it before copying array elements from userspace
into the buffer.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Reported-by: syzbot+ff18193ff05f3f87f226@syzkaller.appspotmail.com
---
diff mbox series

Patch

diff --git a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
index 0f3d6b5667b0..55c26e7d370e 100644
--- a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
+++ b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
@@ -1040,6 +1040,8 @@  int v4l2_compat_get_array_args(struct file *file, void *mbuf,
 {
 	int err = 0;

+	memset(mbuf, 0, array_size);
+
 	switch (cmd) {
 	case VIDIOC_G_FMT32:
 	case VIDIOC_S_FMT32: