scsi: lpfc: Fix premature rpi release for unsolicited TPLS and LS_RJT
authorJames Smart <jsmart2021@gmail.com>
Fri, 10 Sep 2021 23:31:48 +0000 (16:31 -0700)
committerMartin K. Petersen <martin.petersen@oracle.com>
Wed, 15 Sep 2021 03:33:20 +0000 (23:33 -0400)
commit20d2279f90ce87f1d08d2e7ad885a3dcc0678331
tree70e808b2b8ade86f08e7d73d4abd5df6da5a70a8
parent982fc3965d1350d3332e04046b0e101006184ba9
scsi: lpfc: Fix premature rpi release for unsolicited TPLS and LS_RJT

A test scenario has a target issuing a TPLS after accepting the driver's
PRLI.  TPLS is not supported by the driver so it rejects the ELS.  However,
the reject was only happening on the primary N_Port.  If the TPLS was to a
NPIV vport, not only would it reject the ELS, but it would act on the TPLS,
starting devloss, then unregister from the SCSI transport and release the
node. When devloss expired, it would access the node again and cause a page
faul.

Fix by altering the NPIV code to recognize that a correctly registered node
can reject unsolicited ELS I/O and to not unregister with the SCSI
transport and tear the node down.  Add a check of the fc4_xpt_flags so that
only a zero value allows the unreg and teardown.

Link: https://lore.kernel.org/r/20210910233159.115896-4-jsmart2021@gmail.com
Co-developed-by: Justin Tee <justin.tee@broadcom.com>
Signed-off-by: Justin Tee <justin.tee@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/lpfc/lpfc_els.c