mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/2] Fix use after freed situation in UDC core
@ 2025-03-01  0:34 Wesley Cheng
  2025-03-01  0:34 ` [PATCH 1/2] Revert "usb: dwc3: gadget: Fix incorrect UDC state after manual deconfiguration" Wesley Cheng
  2025-03-01  0:34 ` [PATCH 2/2] usb: gadget: udc: Update USB gadget state during soft disconnect Wesley Cheng
  0 siblings, 2 replies; 6+ messages in thread
From: Wesley Cheng @ 2025-03-01  0:34 UTC (permalink / raw)
  To: gregkh, Thinh.Nguyen; +Cc: linux-kernel, linux-usb, Wesley Cheng

commit 1ff24d40b3c3 ("usb: dwc3: gadget: Fix incorrect UDC state after
manual deconfiguration")

Added a use after freed situation due to the fact that the
usb_gadget_set_state() API queuing asynchronous work to be run at a later
time.  When moving from device to host mode, the UDC is removed, and this
is the condition where this is seen.  Relocate this fix from the DWC3
gadget, and apply it within the UDC core, so that we can properly manage
the gadget->work.  It also makes sense, as during soft disconnection
sequence, the USB link is unavailable, so any UDC should reflect the
proper state.

Wesley Cheng (2):
  Revert "usb: dwc3: gadget: Fix incorrect UDC state after manual
    deconfiguration"
  usb: gadget: udc: Update USB gadget state during soft disconnect

 drivers/usb/dwc3/gadget.c     | 2 --
 drivers/usb/gadget/udc/core.c | 5 ++++-
 2 files changed, 4 insertions(+), 3 deletions(-)


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-03-03 23:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-01  0:34 [PATCH 0/2] Fix use after freed situation in UDC core Wesley Cheng
2025-03-01  0:34 ` [PATCH 1/2] Revert "usb: dwc3: gadget: Fix incorrect UDC state after manual deconfiguration" Wesley Cheng
2025-03-01  2:01   ` Thinh Nguyen
2025-03-01  2:33     ` Wesley Cheng
2025-03-03 23:24       ` Thinh Nguyen
2025-03-01  0:34 ` [PATCH 2/2] usb: gadget: udc: Update USB gadget state during soft disconnect Wesley Cheng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®