diff options
author | Icenowy Zheng <icenowy@aosc.io> | 2019-01-03 11:26:17 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-01-16 22:07:11 +0100 |
commit | e43d3143ad116b0559bd8fc0f2948d2e60404343 (patch) | |
tree | 901430cf4e4f0eb2b0f82365ab2243c20ecafdcb | |
parent | d42666bd9f35a91ef870344d27b86f5bb1bfe220 (diff) | |
download | linux-stable-e43d3143ad116b0559bd8fc0f2948d2e60404343.tar.gz linux-stable-e43d3143ad116b0559bd8fc0f2948d2e60404343.tar.bz2 linux-stable-e43d3143ad116b0559bd8fc0f2948d2e60404343.zip |
USB: storage: don't insert sane sense for SPC3+ when bad sense specified
commit c5603d2fdb424849360fe7e3f8c1befc97571b8c upstream.
Currently the code will set US_FL_SANE_SENSE flag unconditionally if
device claims SPC3+, however we should allow US_FL_BAD_SENSE flag to
prevent this behavior, because SMI SM3350 UFS-USB bridge controller,
which claims SPC4, will show strange behavior with 96-byte sense
(put the chip into a wrong state that cannot read/write anything).
Check the presence of US_FL_BAD_SENSE when assuming US_FL_SANE_SENSE on
SPC4+ devices.
Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
Cc: stable <stable@vger.kernel.org>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/usb/storage/scsiglue.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c index 344ec8631481..13f2c051dbf2 100644 --- a/drivers/usb/storage/scsiglue.c +++ b/drivers/usb/storage/scsiglue.c @@ -251,8 +251,12 @@ static int slave_configure(struct scsi_device *sdev) if (!(us->fflags & US_FL_NEEDS_CAP16)) sdev->try_rc_10_first = 1; - /* assume SPC3 or latter devices support sense size > 18 */ - if (sdev->scsi_level > SCSI_SPC_2) + /* + * assume SPC3 or latter devices support sense size > 18 + * unless US_FL_BAD_SENSE quirk is specified. + */ + if (sdev->scsi_level > SCSI_SPC_2 && + !(us->fflags & US_FL_BAD_SENSE)) us->fflags |= US_FL_SANE_SENSE; /* |