Skip to content

RFC USB: UDC: Fix memory leaks by expanding the API

Alan Stern linux-usb 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest4 patches 6 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4USB: UDC: Don't wipe deallocated memorydrivers/usb/gadget/udc/core.c+3 -34 replies
2/4USB: UDC: Expand device model API interfacedrivers/usb/gadget/udc/core.c include/linux/usb/gadget.h+84 -210 replies
3/4USB: UDC: net2280: Fix memory leaksdrivers/usb/gadget/udc/net2280.c drivers/usb/gadget/udc/net2280.h+8 -32 replies
4/4USB: UDC: net2272: Fix memory leaksdrivers/usb/gadget/udc/net2272.c drivers/usb/gadget/udc/net2272.h+13 -90 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH RFC 0/4] USB: UDC: Fix memory leaks by expanding the API

This series fixes some long-standing memory leaks in the net2280 and net2272 drivers. Along the way it expands the UDC/gadget API and addresses a stale pointer issue.

The real problem in net2280 and net2272 is that they need to do a bunch of cleanup operations using their private data structure after the gadget has been unregistered but before it is deallocated. The current API does not offer any way to do this, nor any way to perform setup operations after the gadget is initialized but before it is registered.

Patch 2/4 fixes this by enlarging the API. Using this new functionality, fixing the issues in the two UDC drivers is easy.

The stale pointer issue (patch 1/4) is related to the matter of re-registering a gadget multiple times, which is the subject of a separate email thread.

Alan Stern