Skip to content

Commit e423ee3

Browse files
AlanSternJames Bottomley
authored andcommitted
[SCSI] scsi_scan.c: handle bad inquiry responses
A particular USB device has been reporting short inquiry lengths. The SCSI code cannot operate properly unless we get an inquiry length of 36 or above (because of the way we parse vendor and product), so assume at least 36 bytes are valid even if the device reports fewer. This is wrong, but it's no worse than what we're doing now (using the garbage beyond the last reported valid byte). Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
1 parent a29fdd3 commit e423ee3

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

drivers/scsi/scsi_scan.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -654,6 +654,19 @@ static int scsi_probe_lun(struct scsi_device *sdev, unsigned char *inq_result,
654654
* short INQUIRY), an abort here prevents any further use of the
655655
* device, including spin up.
656656
*
657+
* On the whole, the best approach seems to be to assume the first
658+
* 36 bytes are valid no matter what the device says. That's
659+
* better than copying < 36 bytes to the inquiry-result buffer
660+
* and displaying garbage for the Vendor, Product, or Revision
661+
* strings.
662+
*/
663+
if (sdev->inquiry_len < 36) {
664+
printk(KERN_INFO "scsi scan: INQUIRY result too short (%d),"
665+
" using 36\n", sdev->inquiry_len);
666+
sdev->inquiry_len = 36;
667+
}
668+
669+
/*
657670
* Related to the above issue:
658671
*
659672
* XXX Devices (disk or all?) should be sent a TEST UNIT READY,

0 commit comments

Comments
 (0)