USB: storage: don't insert sane sense for SPC3+ when bad sense specified
authorIcenowy Zheng <icenowy@aosc.io>
Thu, 3 Jan 2019 03:26:17 +0000 (11:26 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 7 Jan 2019 16:23:29 +0000 (17:23 +0100)
commitc5603d2fdb424849360fe7e3f8c1befc97571b8c
tree2a3f30f9ce80ed64583f1d8e4f768436d467f36a
parent34aabf918717dd14e05051896aaecd3b16b53d95
USB: storage: don't insert sane sense for SPC3+ when bad sense specified

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>
drivers/usb/storage/scsiglue.c