scsi: lpfc: Fix kernel Oops due to null pring pointers
authorJames Smart <jsmart2021@gmail.com>
Fri, 30 Nov 2018 00:09:32 +0000 (16:09 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 5 Dec 2019 14:37:08 +0000 (15:37 +0100)
commit2e0c82241c09a79de8d2e9d63b3219b6719a7012
tree46d20e067e7651dc3d17bc7f1b20e544b10f4be7
parentbc34231181d38f730e71d3df5d2b9508390be204
scsi: lpfc: Fix kernel Oops due to null pring pointers

[ Upstream commit 5a9eeff57f340238c39c95d8e7e54c96fc722de7 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/scsi/lpfc/lpfc.h
drivers/scsi/lpfc/lpfc_els.c
drivers/scsi/lpfc/lpfc_init.c
drivers/scsi/lpfc/lpfc_sli.c