All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] USB: serial: garmin_gps: explicitly stop read urb on unbind
@ 2026-10-17 12:10 Johan Hovold
  2026-10-17 12:15 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Johan Hovold @ 2026-10-17 12:10 UTC (permalink / raw)
  To: Johan Hovold; +Cc: linux-usb, linux-kernel

The garmin_gps read URB may be submitted from the interrupt URB
completion handler and should therefore be stopped after stopping the
interrupt URB and before freeing the port data during port unbind.

When a USB serial device is disconnected (or unbound through sysfs),
USB serial core stops and poisons the port URBs before unbinding the
port however so there is no risk for a use-after-free in the read URB
completion handler even if the driver does not stop it in its remove()
callback.

Stop the read URB explicitly for consistency, to avoid relying on core
and to prevent false positive reports from LLMs.

Note that this was erroneously flagged as a use-after-free by Sashiko.

Signed-off-by: Johan Hovold <johan@kernel.org>
---
 drivers/usb/serial/garmin_gps.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/serial/garmin_gps.c b/drivers/usb/serial/garmin_gps.c
index 8020149f5658..1853dc8a747d 100644
--- a/drivers/usb/serial/garmin_gps.c
+++ b/drivers/usb/serial/garmin_gps.c
@@ -1402,6 +1402,7 @@ static void garmin_port_remove(struct usb_serial_port *port)
 
 	usb_kill_anchored_urbs(&garmin_data_p->write_urbs);
 	usb_kill_urb(port->interrupt_in_urb);
+	usb_kill_urb(port->read_urb);
 	timer_shutdown_sync(&garmin_data_p->timer);
 	kfree(garmin_data_p);
 }
-- 
2.55.0


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

* Re: [PATCH] USB: serial: garmin_gps: explicitly stop read urb on unbind
  2026-10-17 12:10 [PATCH] USB: serial: garmin_gps: explicitly stop read urb on unbind Johan Hovold
@ 2026-10-17 12:15 ` sashiko-bot
  0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-10-17 12:15 UTC (permalink / raw)
  To: Johan Hovold; +Cc: linux-usb

> The garmin_gps read URB may be submitted from the interrupt URB
> completion handler and should therefore be stopped after stopping the
> interrupt URB and before freeing the port data during port unbind.
> 
> When a USB serial device is disconnected (or unbound through sysfs),
> USB serial core stops and poisons the port URBs before unbinding the
> port however so there is no risk for a use-after-free in the read URB
> completion handler even if the driver does not stop it in its remove()
> callback.
> 
> Stop the read URB explicitly for consistency, to avoid relying on core
> and to prevent false positive reports from LLMs.
> 
> Note that this was erroneously flagged as a use-after-free by Sashiko.
> 
> Signed-off-by: Johan Hovold <johan@kernel.org>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261017121019.1777984-1-johan@kernel.org?part=1


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

end of thread, other threads:[~2026-10-17 12:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-17 12:10 [PATCH] USB: serial: garmin_gps: explicitly stop read urb on unbind Johan Hovold
2026-10-17 12:15 ` sashiko-bot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.