[lkml]   [2017]   [Aug]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: Inconsistency in usb_add_gadget_udc_release() interface


Alexey Khoroshilov <> writes:
> Hello,
> usb_add_gadget_udc_release() gets release() argument that allows to
> release user resources.
> As far as I can see, the release() is called on error paths
> of usb_add_gadget_udc_release() as a result of
> put_device(&gadget->dev);
> except for the only path going via err1.
> As a result a caller of the usb_add_gadget_udc_release() have no chance
> to know if the release() was invoked or not.
> It may lead to memory leaks (drivers/usb/gadget/udc/snps_udc_core.c)
> or to double free (drivers/usb/gadget/udc/fsl_udc_core.c).
> Is my reading correct? If so, should we always call release() on error paths?

unfortunately, it's not :-)

Note that we don't register gadget->dev until later in the code, so
there's nothing to be ->released() that early.

[unhandled content-type:application/pgp-signature]
 \ /
  Last update: 2017-08-16 09:01    [W:0.070 / U:0.120 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site