linux-stable/drivers/scsi/lpfc
Justin Tee dae40be7a1 scsi: lpfc: Prevent use-after-free during rmmod with mapped NVMe rports
During rmmod, when dev_loss_tmo callback is called, an ndlp kref count is
decremented twice.  Once for SCSI transport registration and second to
remove the initial node allocation kref.  If there is also an NVMe
transport registration, another reference count decrement is expected in
lpfc_nvme_unregister_port().

Race conditions between the NVMe transport remoteport_delete and
dev_loss_tmo callbacks sometimes results in premature ndlp object release
resulting in use-after-free issues.

Fix by not dropping the ndlp object in dev_loss_tmo callback with an
outstanding NVMe transport registration.  Inversely, mark the final
NLP_DROPPED flag in lpfc_nvme_unregister_port when rmmod flag is set.

Signed-off-by: Justin Tee <justin.tee@broadcom.com>
Link: https://lore.kernel.org/r/20230908211923.37603-1-justintee8345@gmail.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2023-09-13 20:51:16 -04:00
..
lpfc.h scsi: lpfc: Do not abuse UUID APIs and LPFC_COMPRESS_VMID_SIZE 2023-08-21 17:13:57 -04:00
lpfc_attr.c scsi: lpfc: Clean up SLI-4 sysfs resource reporting 2023-07-23 16:17:08 -04:00
lpfc_attr.h
lpfc_bsg.c scsi: lpfc: Fix incorrect big endian type assignment in bsg loopback path 2023-06-14 21:57:48 -04:00
lpfc_bsg.h scsi: lpfc: Copyright updates for 14.2.0.5 patches 2022-07-07 17:21:44 -04:00
lpfc_compat.h
lpfc_crtn.h scsi: lpfc: Replace blk_irq_poll intr handler with threaded IRQ 2023-05-08 07:16:05 -04:00
lpfc_ct.c scsi: lpfc: Make fabric zone discovery more robust when handling unsolicited LOGO 2023-07-23 16:17:07 -04:00
lpfc_debugfs.c scsi: lpfc: Fix the NULL vs IS_ERR() bug for debugfs_create_file() 2023-09-13 20:48:36 -04:00
lpfc_debugfs.h scsi: lpfc: Copyright updates for 14.2.0.6 patches 2022-08-31 23:39:58 -04:00
lpfc_disc.h scsi: lpfc: Fix multiple NVMe remoteport registration calls for the same NPort ID 2022-09-15 22:18:27 -04:00
lpfc_els.c scsi: lpfc: Do not abuse UUID APIs and LPFC_COMPRESS_VMID_SIZE 2023-08-21 17:13:57 -04:00
lpfc_hbadisc.c scsi: lpfc: Prevent use-after-free during rmmod with mapped NVMe rports 2023-09-13 20:51:16 -04:00
lpfc_hw.h scsi: lpfc: Set Establish Image Pair service parameter only for Target Functions 2023-07-23 16:17:07 -04:00
lpfc_hw4.h scsi: lpfc: Clean up SLI-4 CQE status handling 2023-05-31 18:14:20 -04:00
lpfc_ids.h scsi: lpfc: Copyright updates for 14.2.0.5 patches 2022-07-07 17:21:44 -04:00
lpfc_init.c scsi: lpfc: Refactor cpu affinity assignment paths 2023-07-23 16:17:07 -04:00
lpfc_logmsg.h scsi: lpfc: Copyright updates for 14.2.0.13 patches 2023-05-31 18:14:20 -04:00
lpfc_mbox.c scsi: lpfc: Fix double word in comments 2023-02-21 22:00:51 -05:00
lpfc_mem.c scsi: lpfc: Copyright updates for 14.2.0.6 patches 2022-08-31 23:39:58 -04:00
lpfc_nl.h
lpfc_nportdisc.c scsi: lpfc: Copyright updates for 14.2.0.14 patches 2023-07-23 16:17:08 -04:00
lpfc_nvme.c scsi: lpfc: Prevent use-after-free during rmmod with mapped NVMe rports 2023-09-13 20:51:16 -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: Refactor cpu affinity assignment paths 2023-07-23 16:17:07 -04:00
lpfc_scsi.c scsi: lpfc: Remove reftag check in DIF paths 2023-08-07 21:34:08 -04:00
lpfc_scsi.h scsi: lpfc: Copyright updates for 14.2.0.6 patches 2022-08-31 23:39:58 -04:00
lpfc_sli.c scsi: lpfc: Abort outstanding ELS cmds when mailbox timeout error is detected 2023-07-23 16:17:07 -04:00
lpfc_sli.h scsi: lpfc: Remove Menlo/Hornet related code 2022-07-07 17:21:44 -04:00
lpfc_sli4.h scsi: lpfc: Replace blk_irq_poll intr handler with threaded IRQ 2023-05-08 07:16:05 -04:00
lpfc_version.h scsi: lpfc: Update lpfc version to 14.2.0.14 2023-07-23 16:17:08 -04:00
lpfc_vmid.c scsi: lpfc: Copyright updates for 14.2.0.10 patches 2023-01-12 00:03:15 -05:00
lpfc_vport.c scsi: lpfc: Copyright updates for 14.2.0.10 patches 2023-01-12 00:03:15 -05:00
lpfc_vport.h scsi: lpfc: Copyright updates for 14.2.0.6 patches 2022-08-31 23:39:58 -04:00
Makefile scsi: lpfc: Commonize VMID code location 2022-05-19 20:24:56 -04:00