linux/drivers/scsi/lpfc
James Smart 4a0f4aff3c scsi: lpfc: Use list_for_each_entry_safe() in rscn_recovery_check()
In GID_PT mode with lpfc_ns_query=1, a race condition between iterating the
vport->fc_nodes list in lpfc_rscn_recovery_check() and cleanup of an ndlp
can trigger a crash while processing the RSCN of another initiator from the
same zone.

During iteration of the vport->fc_nodes list, an ndlp is cleaned up and
released. lpfc_dequeue_node() is called from lpfc_cleanup_node() leading to
a bad ndlp dereference in lpfc_rscn_recovery_check().

Change list_for_each_entry() to list_for_each_entry_safe() in
lpfc_rscn_recovery_check() to protect against removal of an initiator ndlp,
while walking the vport->fc_nodes list.

Link: https://lore.kernel.org/r/20220506035519.50908-7-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>
2022-05-10 22:12:03 -04:00
..
lpfc_attr.c scsi: lpfc: Copyright updates for 14.2.0.2 patches 2022-04-18 22:48:48 -04:00
lpfc_attr.h
lpfc_bsg.c scsi: lpfc: Fix additional reference counting in lpfc_bsg_rport_els() 2022-05-02 16:59:11 -04:00
lpfc_bsg.h scsi: lpfc: Copyright updates for 14.0.0.1 patches 2021-08-24 22:56:34 -04:00
lpfc_compat.h
lpfc_crtn.h scsi: lpfc: Refactor cleanup of mailbox commands 2022-04-18 22:48:47 -04:00
lpfc_ct.c scsi: lpfc: Fix field overload in lpfc_iocbq data structure 2022-04-18 22:48:46 -04:00
lpfc_debugfs.c scsi: lpfc: Use kcalloc() 2022-03-15 00:52:05 -04:00
lpfc_debugfs.h scsi: lpfc: Adjust CMF total bytes and rxmonitor 2021-12-06 22:35:37 -05:00
lpfc_disc.h scsi: lpfc: Allow fabric node recovery if recovery is in progress before devloss 2021-10-20 23:33:46 -04:00
lpfc_els.c scsi: lpfc: Use list_for_each_entry_safe() in rscn_recovery_check() 2022-05-10 22:12:03 -04:00
lpfc_hbadisc.c scsi: lpfc: Inhibit aborts if external loopback plug is inserted 2022-05-10 22:12:03 -04:00
lpfc_hw4.h scsi: lpfc: Expand setting ELS_ID field in ELS_REQUEST64_WQE 2022-04-18 22:48:47 -04:00
lpfc_hw.h scsi: lpfc: Update stat accounting for READ_STATUS mbox command 2022-04-18 22:48:47 -04:00
lpfc_ids.h scsi: lpfc: Copyright updates for 14.0.0.0 patches 2021-07-27 00:06:41 -04:00
lpfc_init.c scsi: lpfc: Change FA-PWWN detection methodology 2022-04-18 22:48:47 -04:00
lpfc_logmsg.h scsi: lpfc: Copyright updates for 14.2.0.2 patches 2022-04-18 22:48:48 -04:00
lpfc_mbox.c scsi: lpfc: Copyright updates for 14.2.0.2 patches 2022-04-18 22:48:48 -04:00
lpfc_mem.c scsi: lpfc: Copyright updates for 14.0.0.1 patches 2021-08-24 22:56:34 -04:00
lpfc_nl.h
lpfc_nportdisc.c scsi: lpfc: Fill in missing ndlp kref puts in error paths 2022-05-10 22:12:02 -04:00
lpfc_nvme.c scsi: lpfc: Fill in missing ndlp kref puts in error paths 2022-05-10 22:12:02 -04:00
lpfc_nvme.h scsi: lpfc: Copyright updates for 14.2.0.0 patches 2022-03-15 13:51:50 -04:00
lpfc_nvmet.c scsi: lpfc: Fix field overload in lpfc_iocbq data structure 2022-04-18 22:48:46 -04:00
lpfc_scsi.c scsi: lpfc: Fix field overload in lpfc_iocbq data structure 2022-04-18 22:48:46 -04:00
lpfc_scsi.h scsi: lpfc: Copyright updates for 14.0.0.0 patches 2021-07-27 00:06:41 -04:00
lpfc_sli4.h scsi: lpfc: Change FA-PWWN detection methodology 2022-04-18 22:48:47 -04:00
lpfc_sli.c scsi: lpfc: Fix dmabuf ptr assignment in lpfc_ct_reject_event() 2022-05-10 22:12:03 -04:00
lpfc_sli.h scsi: lpfc: Refactor cleanup of mailbox commands 2022-04-18 22:48:47 -04:00
lpfc_version.h scsi: lpfc: Update lpfc version to 14.2.0.2 2022-04-18 22:48:47 -04:00
lpfc_vport.c scsi: lpfc: Copyright updates for 14.2.0.2 patches 2022-04-18 22:48:48 -04:00
lpfc_vport.h
lpfc.h scsi: lpfc: Inhibit aborts if external loopback plug is inserted 2022-05-10 22:12:03 -04:00
Makefile