linux/drivers/usb/storage
Weitao Wang cd5432c712 USB: UAS: return ENODEV when submit urbs fail with device not attached
In the scenario of entering hibernation with udisk in the system, if the
udisk was gone or resume fail in the thaw phase of hibernation. Its state
will be set to NOTATTACHED. At this point, usb_hub_wq was already freezed
and can't not handle disconnect event. Next, in the poweroff phase of
hibernation, SYNCHRONIZE_CACHE SCSI command will be sent to this udisk
when poweroff this scsi device, which will cause uas_submit_urbs to be
called to submit URB for sense/data/cmd pipe. However, these URBs will
submit fail as device was set to NOTATTACHED state. Then, uas_submit_urbs
will return a value SCSI_MLQUEUE_DEVICE_BUSY to the caller. That will lead
the SCSI layer go into an ugly loop and system fail to go into hibernation.

On the other hand, when we specially check for -ENODEV in function
uas_queuecommand_lck, returning DID_ERROR to SCSI layer will cause device
poweroff fail and system shutdown instead of entering hibernation.

To fix this issue, let uas_submit_urbs to return original generic error
when submitting URB failed. At the same time, we need to translate -ENODEV
to DID_NOT_CONNECT for the SCSI layer.

Suggested-by: Oliver Neukum <oneukum@suse.com>
Cc: stable@vger.kernel.org
Signed-off-by: Weitao Wang <WeitaoWang-oc@zhaoxin.com>
Link: https://lore.kernel.org/r/20240306180814.4897-1-WeitaoWang-oc@zhaoxin.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-03-26 10:50:56 +01:00
..
alauda.c usb-storage: alauda: Fix uninit-value in alauda_check_media() 2023-08-04 14:57:16 +02:00
cypress_atacb.c scsi: core: Remove the cmd field from struct scsi_request 2022-03-01 22:21:49 -05:00
datafab.c
debug.c scsi: Remove drivers/scsi/scsi.h 2022-02-22 21:11:02 -05:00
debug.h
ene_ub6250.c USB: ene_usb6250: Allocate enough memory for full object 2023-02-06 13:46:42 +01:00
freecom.c usb: storage: freecom: Remove redundant assignment to variable offset 2024-02-17 17:01:10 +01:00
initializers.c
initializers.h
isd200.c USB: usb-storage: Prevent divide-by-0 error in isd200_ata_command 2024-03-02 20:32:03 +01:00
jumpshot.c
karma.c USB: storage: karma: fix rio_karma_init return 2022-04-21 19:03:26 +02:00
Kconfig
Makefile
onetouch.c usb: move from strlcpy with unused retval to strscpy 2022-08-19 11:08:54 +02:00
option_ms.c
option_ms.h
protocol.c
protocol.h
realtek_cr.c USB: storage: ums-realtek: fix error code in rts51x_read_mem() 2022-03-15 18:21:25 +01:00
scsiglue.c scsi: sd: usb_storage: uas: Access media prior to querying device properties 2024-02-14 12:46:47 -05:00
scsiglue.h
sddr09.c
sddr55.c usb: storage: sddr55: fix sloppy typing in sddr55_{read|write}_data() 2024-01-27 16:44:00 -08:00
shuttle_usbat.c usb-storage: shuttle_usbat: fix initFunction error return 2022-04-21 19:02:40 +02:00
sierra_ms.c usb: storage: Remove snprintf() from sysfs call-backs and replace with sysfs_emit() 2023-12-15 13:55:30 +01:00
sierra_ms.h
transport.c USB: storage: Fix typo in comment 2022-06-21 16:39:42 +02: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: return ENODEV when submit urbs fail with device not attached 2024-03-26 10:50:56 +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 quirk for incorrect WP on Kingston DT Ultimate 3.0 G3 2023-12-15 14:00:58 +01: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 uas: Add US_FL_NO_REPORT_OPCODES for JMicron JMS583Gen 2 2023-03-16 12:44:17 +01:00
unusual_usbat.h
usb.c usb-storage,uas: make internal quirks flags 64bit 2023-10-21 12:45:14 +02: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