linux/drivers/scsi/lpfc
John Evans 9dba9a45c3 scsi: lpfc: Fix buffer free/clear order in deferred receive path
Fix a use-after-free window by correcting the buffer release sequence in
the deferred receive path. The code freed the RQ buffer first and only
then cleared the context pointer under the lock. Concurrent paths (e.g.,
ABTS and the repost path) also inspect and release the same pointer under
the lock, so the old order could lead to double-free/UAF.

Note that the repost path already uses the correct pattern: detach the
pointer under the lock, then free it after dropping the lock. The
deferred path should do the same.

Fixes: 472e146d1c ("scsi: lpfc: Correct upcalling nvmet_fc transport during io done downcall")
Cc: stable@vger.kernel.org
Signed-off-by: John Evans <evans1210144@gmail.com>
Link: https://lore.kernel.org/r/20250828044008.743-1-evans1210144@gmail.com
Reviewed-by: Justin Tee <justin.tee@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2025-08-30 21:11:35 -04:00
..
Makefile
lpfc.h SCSI misc on 20250326 2025-03-26 19:57:34 -07:00
lpfc_attr.c sysfs: treewide: switch back to bin_attribute::read()/write() 2025-06-17 10:44:13 +02:00
lpfc_attr.h
lpfc_bsg.c scsi: lpfc: Use secs_to_jiffies() instead of msecs_to_jiffies() 2025-04-28 21:28:36 -04:00
lpfc_bsg.h scsi: lpfc: Copyright updates for 14.4.0.7 patches 2025-01-02 15:01:23 -05:00
lpfc_compat.h
lpfc_crtn.h scsi: lpfc: Copyright updates for 14.4.0.6 patches 2024-11-02 21:45:25 -04:00
lpfc_ct.c scsi: lpfc: Copyright updates for 14.4.0.10 patches 2025-06-23 13:10:34 -04:00
lpfc_debugfs.c Merge branch '6.17/scsi-queue' into 6.17/scsi-fixes 2025-08-12 21:36:18 -04:00
lpfc_debugfs.h lpfc: don't use file->f_path.dentry for comparisons 2025-07-09 13:31:09 +02:00
lpfc_disc.h scsi: lpfc: Change lpfc_nodelist save_flags member into a bitmask 2025-01-02 15:01:22 -05:00
lpfc_els.c scsi: lpfc: Relocate clearing initial phba flags from link up to link down hdlr 2025-06-23 13:10:33 -04:00
lpfc_hbadisc.c scsi: lpfc: Ensure HBA_SETUP flag is used only for SLI4 in dev_loss_tmo_callbk 2025-06-23 13:10:33 -04:00
lpfc_hw.h scsi: lpfc: Copyright updates for 14.4.0.7 patches 2025-01-02 15:01:23 -05:00
lpfc_hw4.h scsi: lpfc: Copyright updates for 14.4.0.10 patches 2025-06-23 13:10:34 -04:00
lpfc_ids.h
lpfc_init.c scsi: lpfc: Modify end-of-life adapters' model descriptions 2025-06-23 13:10:34 -04:00
lpfc_logmsg.h scsi: lpfc: Introduce LOG_NODE_VERBOSE messaging flag 2023-10-13 16:58:27 -04:00
lpfc_mbox.c scsi: lpfc: Restrict the REG_FCFI MAM field to FCoE adapters only 2025-01-02 15:01:22 -05:00
lpfc_mem.c scsi: lpfc: Copyright updates for 14.2.0.16 patches 2023-11-15 09:52:58 -05:00
lpfc_nl.h
lpfc_nportdisc.c Mainly individually changelogged singleton patches. The patch series in 2025-01-26 17:50:53 -08:00
lpfc_nvme.c scsi: lpfc: Copyright updates for 14.4.0.9 patches 2025-04-28 21:38:15 -04:00
lpfc_nvme.h
lpfc_nvmet.c scsi: lpfc: Fix buffer free/clear order in deferred receive path 2025-08-30 21:11:35 -04:00
lpfc_scsi.c scsi: lpfc: Copyright updates for 14.4.0.10 patches 2025-06-23 13:10:34 -04:00
lpfc_scsi.h scsi: lpfc: Copyright updates for 14.4.0.2 patches 2024-05-06 21:53:58 -04:00
lpfc_sli.c scsi: lpfc: Revise CQ_CREATE_SET mailbox bitfield definitions 2025-06-23 13:10:34 -04:00
lpfc_sli.h scsi: lpfc: Copyright updates for 14.4.0.1 patches 2024-03-10 18:56:44 -04:00
lpfc_sli4.h scsi: lpfc: Copyright updates for 14.4.0.10 patches 2025-06-23 13:10:34 -04:00
lpfc_version.h scsi: lpfc: Update lpfc version to 14.4.0.10 2025-06-23 13:10:34 -04:00
lpfc_vmid.c scsi: lpfc: convert timeouts to secs_to_jiffies() 2025-01-12 20:21:03 -08:00
lpfc_vport.c scsi: lpfc: Fix wrong function reference in a comment 2025-08-05 21:57:13 -04:00
lpfc_vport.h