diff options
author | James Smart <james.smart@emulex.com> | 2013-01-03 15:44:09 -0500 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2013-01-29 19:36:47 -0500 |
commit | 0a630c2788e87c65d1ac5ff23bbea10a3b1fbc30 (patch) | |
tree | 2fedcf7b3fd9fce223ca99a9d50f29c5cd549f10 /drivers/scsi/lpfc/lpfc_sli.c | |
parent | 962bc51b04b2725639c47c49404943516ac32b11 (diff) |
[SCSI] lpfc 8.3.37: Fixed crash due to SLI Port invalid resource count
Signed-off-by: James Smart <james.smart@emulex.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_sli.c')
-rw-r--r-- | drivers/scsi/lpfc/lpfc_sli.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c index 0988b320d317..fde41b864384 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c | |||
@@ -5639,6 +5639,13 @@ lpfc_sli4_alloc_resource_identifiers(struct lpfc_hba *phba) | |||
5639 | } | 5639 | } |
5640 | /* RPIs. */ | 5640 | /* RPIs. */ |
5641 | count = phba->sli4_hba.max_cfg_param.max_rpi; | 5641 | count = phba->sli4_hba.max_cfg_param.max_rpi; |
5642 | if (count <= 0) { | ||
5643 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, | ||
5644 | "3279 Invalid provisioning of " | ||
5645 | "rpi:%d\n", count); | ||
5646 | rc = -EINVAL; | ||
5647 | goto err_exit; | ||
5648 | } | ||
5642 | base = phba->sli4_hba.max_cfg_param.rpi_base; | 5649 | base = phba->sli4_hba.max_cfg_param.rpi_base; |
5643 | longs = (count + BITS_PER_LONG - 1) / BITS_PER_LONG; | 5650 | longs = (count + BITS_PER_LONG - 1) / BITS_PER_LONG; |
5644 | phba->sli4_hba.rpi_bmask = kzalloc(longs * | 5651 | phba->sli4_hba.rpi_bmask = kzalloc(longs * |
@@ -5661,6 +5668,13 @@ lpfc_sli4_alloc_resource_identifiers(struct lpfc_hba *phba) | |||
5661 | 5668 | ||
5662 | /* VPIs. */ | 5669 | /* VPIs. */ |
5663 | count = phba->sli4_hba.max_cfg_param.max_vpi; | 5670 | count = phba->sli4_hba.max_cfg_param.max_vpi; |
5671 | if (count <= 0) { | ||
5672 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, | ||
5673 | "3280 Invalid provisioning of " | ||
5674 | "vpi:%d\n", count); | ||
5675 | rc = -EINVAL; | ||
5676 | goto free_rpi_ids; | ||
5677 | } | ||
5664 | base = phba->sli4_hba.max_cfg_param.vpi_base; | 5678 | base = phba->sli4_hba.max_cfg_param.vpi_base; |
5665 | longs = (count + BITS_PER_LONG - 1) / BITS_PER_LONG; | 5679 | longs = (count + BITS_PER_LONG - 1) / BITS_PER_LONG; |
5666 | phba->vpi_bmask = kzalloc(longs * | 5680 | phba->vpi_bmask = kzalloc(longs * |
@@ -5683,6 +5697,13 @@ lpfc_sli4_alloc_resource_identifiers(struct lpfc_hba *phba) | |||
5683 | 5697 | ||
5684 | /* XRIs. */ | 5698 | /* XRIs. */ |
5685 | count = phba->sli4_hba.max_cfg_param.max_xri; | 5699 | count = phba->sli4_hba.max_cfg_param.max_xri; |
5700 | if (count <= 0) { | ||
5701 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, | ||
5702 | "3281 Invalid provisioning of " | ||
5703 | "xri:%d\n", count); | ||
5704 | rc = -EINVAL; | ||
5705 | goto free_vpi_ids; | ||
5706 | } | ||
5686 | base = phba->sli4_hba.max_cfg_param.xri_base; | 5707 | base = phba->sli4_hba.max_cfg_param.xri_base; |
5687 | longs = (count + BITS_PER_LONG - 1) / BITS_PER_LONG; | 5708 | longs = (count + BITS_PER_LONG - 1) / BITS_PER_LONG; |
5688 | phba->sli4_hba.xri_bmask = kzalloc(longs * | 5709 | phba->sli4_hba.xri_bmask = kzalloc(longs * |
@@ -5706,6 +5727,13 @@ lpfc_sli4_alloc_resource_identifiers(struct lpfc_hba *phba) | |||
5706 | 5727 | ||
5707 | /* VFIs. */ | 5728 | /* VFIs. */ |
5708 | count = phba->sli4_hba.max_cfg_param.max_vfi; | 5729 | count = phba->sli4_hba.max_cfg_param.max_vfi; |
5730 | if (count <= 0) { | ||
5731 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, | ||
5732 | "3282 Invalid provisioning of " | ||
5733 | "vfi:%d\n", count); | ||
5734 | rc = -EINVAL; | ||
5735 | goto free_xri_ids; | ||
5736 | } | ||
5709 | base = phba->sli4_hba.max_cfg_param.vfi_base; | 5737 | base = phba->sli4_hba.max_cfg_param.vfi_base; |
5710 | longs = (count + BITS_PER_LONG - 1) / BITS_PER_LONG; | 5738 | longs = (count + BITS_PER_LONG - 1) / BITS_PER_LONG; |
5711 | phba->sli4_hba.vfi_bmask = kzalloc(longs * | 5739 | phba->sli4_hba.vfi_bmask = kzalloc(longs * |