aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSumit.Saxena@avagotech.com <Sumit.Saxena@avagotech.com>2015-01-05 09:36:08 -0500
committerChristoph Hellwig <hch@lst.de>2015-01-09 09:44:34 -0500
commitab2f0608e16d64a23a2dcc8d83b966a0e0a281f3 (patch)
treeb21f069ae8b20a598846ce6d26507a200a8eb641
parent7497cde883b184ead109652f236df98d78090a90 (diff)
megaraid_sas: fix the problem of non-existing VD exposed to host
This patch will address the issue of SCSI device created at OS level for non existing VD. ldTgtIdtoLd[] array has size 256 for Extended VD firmware and 128 for legacy firmware. Accessing indices beyond array size (OS will send TUR, INQUIRY.. commands upto device index 255), may return valid LD value and that particular SCSI command will be SUCCESS and creating SCSI device for non existing target(VD). For legacy firmware (64 VD firmware), invalidates LD (by setting LD value to 0xff) in LdTgtIdtoLd[] array for device index beyond 127, so that invalid LD(0xff) value should be returned beyond device index beyond 127. Cc: <stable@vger.kernel.org> Signed-off-by: Kashyap Desai <kashyap.desai@avagotech.com> Signed-off-by: Sumit Saxena <sumit.saxena@avagotech.com> Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
-rw-r--r--drivers/scsi/megaraid/megaraid_sas_fp.c3
-rw-r--r--drivers/scsi/megaraid/megaraid_sas_fusion.c14
2 files changed, 15 insertions, 2 deletions
diff --git a/drivers/scsi/megaraid/megaraid_sas_fp.c b/drivers/scsi/megaraid/megaraid_sas_fp.c
index 7cae1c25c9a9..4f72287860ee 100644
--- a/drivers/scsi/megaraid/megaraid_sas_fp.c
+++ b/drivers/scsi/megaraid/megaraid_sas_fp.c
@@ -212,6 +212,9 @@ void MR_PopulateDrvRaidMap(struct megasas_instance *instance)
212 for (i = 0; i < MAX_RAIDMAP_LOGICAL_DRIVES + MAX_RAIDMAP_VIEWS; i++) 212 for (i = 0; i < MAX_RAIDMAP_LOGICAL_DRIVES + MAX_RAIDMAP_VIEWS; i++)
213 pDrvRaidMap->ldTgtIdToLd[i] = 213 pDrvRaidMap->ldTgtIdToLd[i] =
214 (u8)pFwRaidMap->ldTgtIdToLd[i]; 214 (u8)pFwRaidMap->ldTgtIdToLd[i];
215 for (i = (MAX_RAIDMAP_LOGICAL_DRIVES + MAX_RAIDMAP_VIEWS);
216 i < MAX_LOGICAL_DRIVES_EXT; i++)
217 pDrvRaidMap->ldTgtIdToLd[i] = 0xff;
215 for (i = 0; i < ld_count; i++) { 218 for (i = 0; i < ld_count; i++) {
216 pDrvRaidMap->ldSpanMap[i] = pFwRaidMap->ldSpanMap[i]; 219 pDrvRaidMap->ldSpanMap[i] = pFwRaidMap->ldSpanMap[i];
217#if VD_EXT_DEBUG 220#if VD_EXT_DEBUG
diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c
index af5ab9e5e8e5..7b23d347b69c 100644
--- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
+++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
@@ -1725,9 +1725,19 @@ megasas_build_dcdb_fusion(struct megasas_instance *instance,
1725 if (scmd->device->channel < MEGASAS_MAX_PD_CHANNELS) 1725 if (scmd->device->channel < MEGASAS_MAX_PD_CHANNELS)
1726 goto NonFastPath; 1726 goto NonFastPath;
1727 1727
1728 /*
1729 * For older firmware, Driver should not access ldTgtIdToLd
1730 * beyond index 127 and for Extended VD firmware, ldTgtIdToLd
1731 * should not go beyond 255.
1732 */
1733
1734 if ((!fusion->fast_path_io) ||
1735 (device_id >= instance->fw_supported_vd_count))
1736 goto NonFastPath;
1737
1728 ld = MR_TargetIdToLdGet(device_id, local_map_ptr); 1738 ld = MR_TargetIdToLdGet(device_id, local_map_ptr);
1729 if ((ld >= instance->fw_supported_vd_count) || 1739
1730 (!fusion->fast_path_io)) 1740 if (ld >= instance->fw_supported_vd_count)
1731 goto NonFastPath; 1741 goto NonFastPath;
1732 1742
1733 raid = MR_LdRaidGet(ld, local_map_ptr); 1743 raid = MR_LdRaidGet(ld, local_map_ptr);