[lkml]   [2017]   [Aug]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH] udc: Memory leak on error path and use after free
On Wed, 16 Aug 2017, Anton Vasilyev wrote:

> gadget_release() is responsible for cleanup dev memory.
> But if net2280_probe() fails after dev allocation, then
> gadget_release() become unregistered and dev memory leaks.

This isn't needed if usb_add_gadget_udc_release() is fixed, right?

> Also net2280_remove() calls usb_del_gadget_udc() which
> perform schedule_delayed_work() with gadget_release(), so
> it is possible that dev will be deallocated exactly after
> this call and leads to use after free.

Where is there a possible use after free?

> The patch moves deallocation from gadget_release() to
> net2280_remove().

Alan Stern

 \ /
  Last update: 2017-08-16 17:29    [W:0.042 / U:3.196 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site