Skip to contentSkip to conversation

USB: cdc-acm: fix urb leak on disconnect

PATCH New Johan Hovold 2 participants 2 messages Oct 9

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 USB: cdc-acm: fix urb leak on disconnect

Make sure to drop the reference taken by usb_anchor_urb() when removing URBs from the delayed URB anchor to prevent them from leaking when the device is later disconnected.

Fixes 140cb81ac8c6 ("USB: cdc-acm: fix broken runtime suspend")
---
 drivers/usb/class/cdc-acm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/class/cdc-acm.c +2 -1
index 7bc5329fa3ed..140e4f241b7a 100644
@@ -783,6 +783,7 @@ static void acm_port_shutdown(struct tty_port *port)
 		urb = usb_get_from_anchor(&acm->delayed);
 		if (!urb)
 			break;
+		usb_put_urb(urb);
 		wb = urb->context;
 		wb->use = false;
 		usb_autopm_put_interface_async(acm->control);
@@ -1705,7 +1706,7 @@ static int acm_resume(struct usb_interface *intf)
 			urb = usb_get_from_anchor(&acm->delayed);
 			if (!urb)
 				break;
-
+			usb_put_urb(urb);
 			acm_start_wb(acm, urb->context);
 		}
 
Signature · 1 line
2.55.0
#1 lore raw
Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 9 lines

Make sure to drop the reference taken by usb_anchor_urb() when removing URBs from the delayed URB anchor to prevent them from leaking when the device is later disconnected.

Fixes 140cb81ac8c6 ("USB: cdc-acm: fix broken runtime suspend")

Sashiko has reviewed this patch and found no issues. It looks great!

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1