Skip to content

Commit 3ee7ef7

Browse files
Oliver Neukumgregkh
authored andcommitted
usb-storage: add quirk for mandatory READ_CAPACITY_16
commit 32c37fc upstream. Some USB drive enclosures do not correctly report an overflow condition if they hold a drive with a capacity over 2TB and are confronted with a READ_CAPACITY_10. They answer with their capacity modulo 2TB. The generic layer cannot cope with that. It must be told to use READ_CAPACITY_16 from the beginning. Signed-off-by: Oliver Neukum <oneukum@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent a368a29 commit 3ee7ef7

3 files changed

Lines changed: 14 additions & 2 deletions

File tree

‎drivers/usb/storage/scsiglue.c‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,11 @@ static int slave_configure(struct scsi_device *sdev)
211211
/*
212212
* Many devices do not respond properly to READ_CAPACITY_16.
213213
* Tell the SCSI layer to try READ_CAPACITY_10 first.
214+
* However some USB 3.0 drive enclosures return capacity
215+
* modulo 2TB. Those must use READ_CAPACITY_16
214216
*/
215-
sdev->try_rc_10_first = 1;
217+
if (!(us->fflags & US_FL_NEEDS_CAP16))
218+
sdev->try_rc_10_first = 1;
216219

217220
/* assume SPC3 or latter devices support sense size > 18 */
218221
if (sdev->scsi_level > SCSI_SPC_2)

‎drivers/usb/storage/unusual_devs.h‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1925,6 +1925,13 @@ UNUSUAL_DEV( 0x1652, 0x6600, 0x0201, 0x0201,
19251925
USB_SC_DEVICE, USB_PR_DEVICE, NULL,
19261926
US_FL_IGNORE_RESIDUE ),
19271927

1928+
/* Reported by Oliver Neukum <oneukum@suse.com> */
1929+
UNUSUAL_DEV( 0x174c, 0x55aa, 0x0100, 0x0100,
1930+
"ASMedia",
1931+
"AS2105",
1932+
USB_SC_DEVICE, USB_PR_DEVICE, NULL,
1933+
US_FL_NEEDS_CAP16),
1934+
19281935
/* Reported by Jesse Feddema <jdfeddema@gmail.com> */
19291936
UNUSUAL_DEV( 0x177f, 0x0400, 0x0000, 0x0000,
19301937
"Yarvik",

‎include/linux/usb_usual.h‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,9 @@
6666
US_FLAG(INITIAL_READ10, 0x00100000) \
6767
/* Initial READ(10) (and others) must be retried */ \
6868
US_FLAG(WRITE_CACHE, 0x00200000) \
69-
/* Write Cache status is not available */
69+
/* Write Cache status is not available */ \
70+
US_FLAG(NEEDS_CAP16, 0x00400000)
71+
/* cannot handle READ_CAPACITY_10 */
7072

7173
#define US_FLAG(name, value) US_FL_##name = value ,
7274
enum { US_DO_ALL_FLAGS };

0 commit comments

Comments
 (0)