[SCSI] lpfc 8.3.37: Fixed crash due to SLI Port invalid resource count
authorJames Smart <james.smart@emulex.com>
Thu, 3 Jan 2013 20:44:09 +0000 (15:44 -0500)
committerJames Bottomley <JBottomley@Parallels.com>
Wed, 30 Jan 2013 00:36:47 +0000 (11:36 +1100)
Signed-off-by: James Smart <james.smart@emulex.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
drivers/scsi/lpfc/lpfc_sli.c

index 0988b320d317c7f5c1b601dc59e78975a38332d0..fde41b86438463d2f3c4f5281fe2d12345eeabe1 100644 (file)
@@ -5639,6 +5639,13 @@ lpfc_sli4_alloc_resource_identifiers(struct lpfc_hba *phba)
                }
                /* RPIs. */
                count = phba->sli4_hba.max_cfg_param.max_rpi;
+               if (count <= 0) {
+                       lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
+                                       "3279 Invalid provisioning of "
+                                       "rpi:%d\n", count);
+                       rc = -EINVAL;
+                       goto err_exit;
+               }
                base = phba->sli4_hba.max_cfg_param.rpi_base;
                longs = (count + BITS_PER_LONG - 1) / BITS_PER_LONG;
                phba->sli4_hba.rpi_bmask = kzalloc(longs *
@@ -5661,6 +5668,13 @@ lpfc_sli4_alloc_resource_identifiers(struct lpfc_hba *phba)
 
                /* VPIs. */
                count = phba->sli4_hba.max_cfg_param.max_vpi;
+               if (count <= 0) {
+                       lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
+                                       "3280 Invalid provisioning of "
+                                       "vpi:%d\n", count);
+                       rc = -EINVAL;
+                       goto free_rpi_ids;
+               }
                base = phba->sli4_hba.max_cfg_param.vpi_base;
                longs = (count + BITS_PER_LONG - 1) / BITS_PER_LONG;
                phba->vpi_bmask = kzalloc(longs *
@@ -5683,6 +5697,13 @@ lpfc_sli4_alloc_resource_identifiers(struct lpfc_hba *phba)
 
                /* XRIs. */
                count = phba->sli4_hba.max_cfg_param.max_xri;
+               if (count <= 0) {
+                       lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
+                                       "3281 Invalid provisioning of "
+                                       "xri:%d\n", count);
+                       rc = -EINVAL;
+                       goto free_vpi_ids;
+               }
                base = phba->sli4_hba.max_cfg_param.xri_base;
                longs = (count + BITS_PER_LONG - 1) / BITS_PER_LONG;
                phba->sli4_hba.xri_bmask = kzalloc(longs *
@@ -5706,6 +5727,13 @@ lpfc_sli4_alloc_resource_identifiers(struct lpfc_hba *phba)
 
                /* VFIs. */
                count = phba->sli4_hba.max_cfg_param.max_vfi;
+               if (count <= 0) {
+                       lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
+                                       "3282 Invalid provisioning of "
+                                       "vfi:%d\n", count);
+                       rc = -EINVAL;
+                       goto free_xri_ids;
+               }
                base = phba->sli4_hba.max_cfg_param.vfi_base;
                longs = (count + BITS_PER_LONG - 1) / BITS_PER_LONG;
                phba->sli4_hba.vfi_bmask = kzalloc(longs *
This page took 0.034625 seconds and 5 git commands to generate.