This is a note to let you know that I've just added the patch titled

    megaraid_sas: fix the problem of non-existing VD exposed to host

to the 3.18-stable tree which can be found at:
    
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     megaraid_sas-fix-the-problem-of-non-existing-vd-exposed-to-host.patch
and it can be found in the queue-3.18 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <[email protected]> know about it.


>From ab2f0608e16d64a23a2dcc8d83b966a0e0a281f3 Mon Sep 17 00:00:00 2001
From: "[email protected]" <[email protected]>
Date: Mon, 5 Jan 2015 20:06:08 +0530
Subject: megaraid_sas: fix the problem of non-existing VD exposed to host

From: "[email protected]" <[email protected]>

commit ab2f0608e16d64a23a2dcc8d83b966a0e0a281f3 upstream.

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.

Signed-off-by: Kashyap Desai <[email protected]>
Signed-off-by: Sumit Saxena <[email protected]>
Reviewed-by: Martin K. Petersen <[email protected]>
Signed-off-by: Christoph Hellwig <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
 drivers/scsi/megaraid/megaraid_sas_fp.c     |    3 +++
 drivers/scsi/megaraid/megaraid_sas_fusion.c |   14 ++++++++++++--
 2 files changed, 15 insertions(+), 2 deletions(-)

--- a/drivers/scsi/megaraid/megaraid_sas_fp.c
+++ b/drivers/scsi/megaraid/megaraid_sas_fp.c
@@ -210,6 +210,9 @@ void MR_PopulateDrvRaidMap(struct megasa
                for (i = 0; i < MAX_RAIDMAP_LOGICAL_DRIVES + MAX_RAIDMAP_VIEWS; 
i++)
                        pDrvRaidMap->ldTgtIdToLd[i] =
                                (u8)pFwRaidMap->ldTgtIdToLd[i];
+               for (i = (MAX_RAIDMAP_LOGICAL_DRIVES + MAX_RAIDMAP_VIEWS);
+                       i < MAX_LOGICAL_DRIVES_EXT; i++)
+                       pDrvRaidMap->ldTgtIdToLd[i] = 0xff;
                for (i = 0; i < ld_count; i++) {
                        pDrvRaidMap->ldSpanMap[i] = pFwRaidMap->ldSpanMap[i];
 #if VD_EXT_DEBUG
--- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
+++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
@@ -1752,9 +1752,19 @@ megasas_build_dcdb_fusion(struct megasas
                if (scmd->device->channel < MEGASAS_MAX_PD_CHANNELS)
                        goto NonFastPath;
 
+               /*
+                * For older firmware, Driver should not access ldTgtIdToLd
+                * beyond index 127 and for Extended VD firmware, ldTgtIdToLd
+                * should not go beyond 255.
+                */
+
+               if ((!fusion->fast_path_io) ||
+                       (device_id >= instance->fw_supported_vd_count))
+                       goto NonFastPath;
+
                ld = MR_TargetIdToLdGet(device_id, local_map_ptr);
-               if ((ld >= instance->fw_supported_vd_count) ||
-                       (!fusion->fast_path_io))
+
+               if (ld >= instance->fw_supported_vd_count)
                        goto NonFastPath;
 
                raid = MR_LdRaidGet(ld, local_map_ptr);


Patches currently in stable-queue which might be from 
[email protected] are

queue-3.18/megaraid_sas-endianness-related-bug-fixes-and-code-optimization.patch
queue-3.18/megaraid_sas-disable-interrupt_mask-before-enabling-hardware-interrupts.patch
queue-3.18/megaraid_sas-fix-the-problem-of-non-existing-vd-exposed-to-host.patch
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to