diff options
| author | Johan Hovold <johan@kernel.org> | 2026-08-21 17:45:45 +0200 |
|---|---|---|
| committer | Johan Hovold <johan@kernel.org> | 2026-09-08 11:00:48 +0200 |
| commit | 646e5b28b4fdbc1b828a2398d6ced2c1dd308a46 (patch) | |
| tree | 9c66819a6a49bbe590b1a55effa77120d9b35848 /include/linux | |
| parent | 63594e8ffe097bc0b7639936f33799a7653dded2 (diff) | |
USB: serial: fix driver deregistration order
USB serial driver modules register one driver for the USB bus and one or
more drivers for the ports on the USB serial bus.
When unloading a driver module, the USB driver must be deregistered
before the USB serial bus drivers so that I/O is stopped before
unbinding the ports to avoid use-after-free in completion handlers
accessing port data.
Note that the "new_id" attributes must first be removed to prevent new
ids from being added and triggering a probe of the USB driver after it
has been deregistered.
Fixes: 765e0ba62613 ("usb-serial: new API for driver registration")
Cc: stable@vger.kernel.org # 3.4
Cc: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Johan Hovold <johan@kernel.org>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/usb/serial.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h index 534e6650e2aa..ab0a32a90629 100644 --- a/include/linux/usb/serial.h +++ b/include/linux/usb/serial.h @@ -381,6 +381,7 @@ void usb_serial_handle_dcd_change(struct usb_serial_port *usb_port, int usb_serial_bus_register(struct usb_serial_driver *device); void usb_serial_bus_deregister(struct usb_serial_driver *device); +void usb_serial_bus_remove_new_id(struct usb_serial_driver *driver); extern const struct bus_type usb_serial_bus_type; extern struct tty_driver *usb_serial_tty_driver; |
