[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201220115113.GA26370@paasikivi.fi.intel.com>
Date: Sun, 20 Dec 2020 13:51:13 +0200
From: Sakari Ailus <sakari.ailus@...ux.intel.com>
To: Arnd Bergmann <arnd@...nel.org>
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:36:23PM +0100, Arnd Bergmann wrote:
> 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>
Thanks!
>
> > 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.
Good point. I can send a patch for that, too.
--
Sakari Ailus
Powered by blists - more mailing lists