On Sun, Dec 20, 2020 at 12:06 PM Sakari Ailus <[email protected]> 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 <[email protected]> > Reported-by: [email protected] > Fixes: d14e6d76ebf7 ("[media] v4l: Add multi-planar ioctl handling code") > Cc: [email protected] > Signed-off-by: Sakari Ailus <[email protected]>
Acked-by: Arnd Bergmann <[email protected]> > 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

