[SCSI] megaraid_sas: Add array boundary check for SystemPD
authoradam radford <aradford@gmail.com>
Tue, 2 Oct 2012 02:27:12 +0000 (19:27 -0700)
committerJames Bottomley <JBottomley@Parallels.com>
Tue, 9 Oct 2012 10:19:11 +0000 (11:19 +0100)
Signed-off-by: Adam Radford <aradford@gmail.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
drivers/scsi/megaraid/megaraid_sas_fusion.c

index 31d397497c456db44d0b67a4a4a96303d6ff4043..ad6e2ac196b01e540a80bf69181d354249c7f3b0 100644 (file)
@@ -1508,7 +1508,8 @@ megasas_build_dcdb_fusion(struct megasas_instance *instance,
        local_map_ptr = fusion->ld_map[(instance->map_id & 1)];
 
        /* Check if this is a system PD I/O */
-       if (instance->pd_list[pd_index].driveState == MR_PD_STATE_SYSTEM) {
+       if (scmd->device->channel < MEGASAS_MAX_PD_CHANNELS &&
+           instance->pd_list[pd_index].driveState == MR_PD_STATE_SYSTEM) {
                io_request->Function = 0;
                io_request->DevHandle =
                        local_map_ptr->raidMap.devHndlInfo[device_id].curDevHdl;