summaryrefslogtreecommitdiff
path: root/drivers/scsi/lpfc/lpfc.h
diff options
context:
space:
mode:
authorJames Smart <jsmart2021@gmail.com>2018-11-29 16:09:32 -0800
committerMartin K. Petersen <martin.petersen@oracle.com>2018-12-07 22:35:32 -0500
commit5a9eeff57f340238c39c95d8e7e54c96fc722de7 (patch)
treef2073f16fb1c9fd2bed74791b7fe6828139a5865 /drivers/scsi/lpfc/lpfc.h
parent2c4c91415a05677acc5c8131a5eb472d4aa96ae1 (diff)
scsi: lpfc: Fix kernel Oops due to null pring pointers
Driver is hitting null pring pointers in lpfc_do_work(). Pointer assignment occurs based on SLI-revision. If recovering after an error, its possible the sli revision for the port was cleared, making the lpfc_phba_elsring() not return a ring pointer, thus the null pointer. Add SLI revision checking to lpfc_phba_elsring() and status checking to all callers. Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com> Signed-off-by: James Smart <jsmart2021@gmail.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/lpfc/lpfc.h')
-rw-r--r--drivers/scsi/lpfc/lpfc.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h
index c23c29b451c2..b37e0caf0781 100644
--- a/drivers/scsi/lpfc/lpfc.h
+++ b/drivers/scsi/lpfc/lpfc.h
@@ -1277,6 +1277,12 @@ lpfc_sli_read_hs(struct lpfc_hba *phba)
static inline struct lpfc_sli_ring *
lpfc_phba_elsring(struct lpfc_hba *phba)
{
+ /* Return NULL if sli_rev has become invalid due to bad fw */
+ if (phba->sli_rev != LPFC_SLI_REV4 &&
+ phba->sli_rev != LPFC_SLI_REV3 &&
+ phba->sli_rev != LPFC_SLI_REV2)
+ return NULL;
+
if (phba->sli_rev == LPFC_SLI_REV4) {
if (phba->sli4_hba.els_wq)
return phba->sli4_hba.els_wq->pring;