[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAK8P3a3s=yU=PW7zLc4M83DksxAsb=v8r4U6aAySj2-nmeczjA@mail.gmail.com>
Date: Sun, 20 Dec 2020 12:36:23 +0100
From: Arnd Bergmann <arnd@...nel.org>
To: Sakari Ailus <sakari.ailus@...ux.intel.com>
Cc: Linux Media Mailing List <linux-media@...r.kernel.org>,
syzbot <syzbot+1115e79c8df6472c612b@...kaller.appspotmail.com>,
Arnd Bergmann <arnd@...db.de>,
Hans Verkuil <hverkuil-cisco@...all.nl>,
Laurent Pinchart <laurent.pinchart@...asonboard.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
syzkaller-bugs <syzkaller-bugs@...glegroups.com>
Subject: Re: [PATCH 1/1] v4l: ioctl: Fix memory leak in video_usercopy
On Sun, Dec 20, 2020 at 12:06 PM Sakari Ailus
<sakari.ailus@...ux.intel.com> wrote:
>
> When an IOCTL with argument size larger than 128 that also used array
> arguments were handled, two memory allocations were made but alas, only
> the latter one of them was released. This happened because there was only
> a single local variable to hold such a temporary allocation.
>
> Fix this by adding separate variables to hold the pointers to the
> temporary allocations.
>
> Reported-by: Arnd Bergmann <arnd@...nel.org>
> Reported-by: syzbot+1115e79c8df6472c612b@...kaller.appspotmail.com
> Fixes: d14e6d76ebf7 ("[media] v4l: Add multi-planar ioctl handling code")
> Cc: stable@...r.kernel.org
> Signed-off-by: Sakari Ailus <sakari.ailus@...ux.intel.com>
Acked-by: Arnd Bergmann <arnd@...db.de>
> out:
> + kvfree(array_buf);
> kvfree(mbuf);
I think it would make sense to change mbuf back to kzalloc()/kfree
after this, since the size of the ioctl argument has an upper bound
of 2^_IOC_SIZEBITS (16KB), which does not need the vmalloc
path, unlike the array args.
Arnd
Powered by blists - more mailing lists