aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/scsi/scsi_lib.c13
-rw-r--r--drivers/scsi/sd.c6
2 files changed, 17 insertions, 2 deletions
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 1fe4fd83e305..eab303d148d8 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1892,8 +1892,16 @@ scsi_mode_sense(struct scsi_device *sdev, int dbd, int modepage,
1892 } 1892 }
1893 1893
1894 if(scsi_status_is_good(result)) { 1894 if(scsi_status_is_good(result)) {
1895 data->header_length = header_length; 1895 if (unlikely(buffer[0] == 0x86 && buffer[1] == 0x0b &&
1896 if(use_10_for_ms) { 1896 (modepage == 6 || modepage == 8))) {
1897 /* Initio breakage? */
1898 header_length = 0;
1899 data->length = 13;
1900 data->medium_type = 0;
1901 data->device_specific = 0;
1902 data->longlba = 0;
1903 data->block_descriptor_length = 0;
1904 } else if(use_10_for_ms) {
1897 data->length = buffer[0]*256 + buffer[1] + 2; 1905 data->length = buffer[0]*256 + buffer[1] + 2;
1898 data->medium_type = buffer[2]; 1906 data->medium_type = buffer[2];
1899 data->device_specific = buffer[3]; 1907 data->device_specific = buffer[3];
@@ -1906,6 +1914,7 @@ scsi_mode_sense(struct scsi_device *sdev, int dbd, int modepage,
1906 data->device_specific = buffer[2]; 1914 data->device_specific = buffer[2];
1907 data->block_descriptor_length = buffer[3]; 1915 data->block_descriptor_length = buffer[3];
1908 } 1916 }
1917 data->header_length = header_length;
1909 } 1918 }
1910 1919
1911 return result; 1920 return result;
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 76b4d14c0b3f..31c9685ebc5a 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -1333,6 +1333,12 @@ sd_read_cache_type(struct scsi_disk *sdkp, char *diskname,
1333 if (!scsi_status_is_good(res)) 1333 if (!scsi_status_is_good(res))
1334 goto bad_sense; 1334 goto bad_sense;
1335 1335
1336 if (!data.header_length) {
1337 modepage = 6;
1338 printk(KERN_ERR "%s: missing header in MODE_SENSE response\n",
1339 diskname);
1340 }
1341
1336 /* that went OK, now ask for the proper length */ 1342 /* that went OK, now ask for the proper length */
1337 len = data.length; 1343 len = data.length;
1338 1344