]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
scsi: lpfc: Fix null pointer dereference in lpfc_prep_els_iocb()
authorJames Smart <jsmart2021@gmail.com>
Mon, 1 Mar 2021 17:18:08 +0000 (09:18 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 14 May 2021 08:49:51 +0000 (10:49 +0200)
commita09677de458d500b00701f6036baa423d9995408
tree1671a573dc290b6dfccdee37b6173adfabb4f8f0
parente326f81ccd5b958dd346c9e14a9e1f9fda3df968
scsi: lpfc: Fix null pointer dereference in lpfc_prep_els_iocb()

[ Upstream commit 8dd1c125f7f838abad009b64bff5f0a11afe3cb6 ]

It is possible to call lpfc_issue_els_plogi() passing a did for which no
matching ndlp is found. A call is then made to lpfc_prep_els_iocb() with a
null pointer to a lpfc_nodelist structure resulting in a null pointer
dereference.

Fix by returning an error status if no valid ndlp is found. Fix up comments
regarding ndlp reference counting.

Link: https://lore.kernel.org/r/20210301171821.3427-10-jsmart2021@gmail.com
Fixes: 4430f7fd09ec ("scsi: lpfc: Rework locations of ndlp reference taking")
Co-developed-by: Dick Kennedy <dick.kennedy@broadcom.com>
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_els.c