* [PATCH for 5.18] v4l2-compat-ioctl32.c: zero buffer passed to v4l2_compat_get_array_args()
@ 2022-03-21 8:33 Hans Verkuil
2022-03-21 11:52 ` Hans Verkuil
2022-03-21 11:56 ` Laurent Pinchart
0 siblings, 2 replies; 3+ messages in thread
From: Hans Verkuil @ 2022-03-21 8:33 UTC (permalink / raw)
To: Linux Media Mailing List
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 --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:
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH for 5.18] v4l2-compat-ioctl32.c: zero buffer passed to v4l2_compat_get_array_args()
2022-03-21 8:33 [PATCH for 5.18] v4l2-compat-ioctl32.c: zero buffer passed to v4l2_compat_get_array_args() Hans Verkuil
@ 2022-03-21 11:52 ` Hans Verkuil
2022-03-21 11:56 ` Laurent Pinchart
1 sibling, 0 replies; 3+ messages in thread
From: Hans Verkuil @ 2022-03-21 11:52 UTC (permalink / raw)
To: Linux Media Mailing List
On 21/03/2022 09:33, Hans Verkuil wrote:
> 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
Fixes: 8dbcc3fa387c (media: v4l2: prepare compat-ioctl rework)
> ---
> 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:
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH for 5.18] v4l2-compat-ioctl32.c: zero buffer passed to v4l2_compat_get_array_args()
2022-03-21 8:33 [PATCH for 5.18] v4l2-compat-ioctl32.c: zero buffer passed to v4l2_compat_get_array_args() Hans Verkuil
2022-03-21 11:52 ` Hans Verkuil
@ 2022-03-21 11:56 ` Laurent Pinchart
1 sibling, 0 replies; 3+ messages in thread
From: Laurent Pinchart @ 2022-03-21 11:56 UTC (permalink / raw)
To: Hans Verkuil; +Cc: Linux Media Mailing List
Hi Hans,
Thank you for the patch.
On Mon, Mar 21, 2022 at 09:33:56AM +0100, Hans Verkuil wrote:
> 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
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
> 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:
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-03-21 11:57 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-21 8:33 [PATCH for 5.18] v4l2-compat-ioctl32.c: zero buffer passed to v4l2_compat_get_array_args() Hans Verkuil
2022-03-21 11:52 ` Hans Verkuil
2022-03-21 11:56 ` Laurent Pinchart
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).