linux/drivers/usb/storage
Myeonghun Pak 4ffee1aebb usb: storage: realtek_cr: fix use-after-free on disconnect
realtek_cr_destructor() calls timer_delete() before the chip containing
the timer is freed. The timer callback may still be running and can
rearm itself, resulting in a use-after-free.

Use timer_shutdown_sync() to wait for the callback and prevent further
rearming. Do this unconditionally because ss_en may be changed after
the timer is armed.

Move timer_setup() into init_realtek_cr() so the timer is initialized
before any failure path can invoke the destructor.

Found by static analysis.

Fixes: e931830bb8 ("Realtek cr: Add autosuspend function.")
Cc: stable <stable@kernel.org>
Co-developed-by: Ijae Kim <ae878000@gmail.com>
Signed-off-by: Ijae Kim <ae878000@gmail.com>
Signed-off-by: Myeonghun Pak <mhun512@gmail.com>
Link: https://patch.msgid.link/20260727123414.44700-1-mhun512@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2026-09-01 16:48:45 +02:00
..
alauda.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
cypress_atacb.c module: Convert symbol namespace to string literal 2024-12-02 11:34:44 -08:00
datafab.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
debug.c scsi: usb: Rename the RESERVE and RELEASE constants 2025-02-12 22:20:55 -05:00
debug.h
ene_ub6250.c usb-storage: ene_ub6250: fix race between scan work and probe 2026-09-01 16:43:32 +02:00
freecom.c module: Convert symbol namespace to string literal 2024-12-02 11:34:44 -08:00
initializers.c usb: storage: initializers: Use const for constant array 2025-03-03 10:24:41 +01:00
initializers.h
isd200.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
jumpshot.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
karma.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
Kconfig usb: collapse USB_STORAGE Kconfig comment 2024-12-04 16:08:42 +01:00
Makefile module: Convert default symbol namespace to string literal 2024-12-03 08:22:25 -08:00
onetouch.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
option_ms.c
option_ms.h
protocol.c drivers/usb/storage: use min() instead of min_t() 2025-11-21 15:17:24 +01:00
protocol.h
realtek_cr.c usb: storage: realtek_cr: fix use-after-free on disconnect 2026-09-01 16:48:45 +02:00
scsiglue.c scsi: Change the return type of the .queuecommand() callback 2026-01-23 21:32:34 -05:00
scsiglue.h
sddr09.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
sddr55.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
shuttle_usbat.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
sierra_ms.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
sierra_ms.h
transport.c usb: storage: Fix memory leak in USB bulk transport 2025-11-09 10:56:05 +09:00
transport.h
uas-detect.h usb-storage,uas: make internal quirks flags 64bit 2023-10-21 12:45:14 +02:00
uas.c USB: uas: give the error handler the correct name 2026-03-18 16:01:09 +01:00
unusual_alauda.h
unusual_cypress.h usb: storage: set 1.50 as the lower bcdDevice for older "Super Top" compatibility 2023-10-28 12:23:41 +02:00
unusual_datafab.h
unusual_devs.h USB: storage: add NO_ATA_1X quirk for Longmai USB Key 2026-07-16 17:11:02 +02:00
unusual_ene_ub6250.h
unusual_freecom.h
unusual_isd200.h
unusual_jumpshot.h
unusual_karma.h
unusual_onetouch.h
unusual_realtek.h
unusual_sddr09.h
unusual_sddr55.h
unusual_uas.h usb: storage: Add quirks for PNY Elite Portable SSD 2026-05-22 11:12:47 +02:00
unusual_usbat.h
usb.c USB: storage: include US_FL_NO_SAME in quirks mask 2026-06-25 15:11:05 +01:00
usb.h usb-storage,uas: make internal quirks flags 64bit 2023-10-21 12:45:14 +02:00
usual-tables.c usb-storage,uas: make internal quirks flags 64bit 2023-10-21 12:45:14 +02:00