linux-stable/drivers/scsi
John Evans 55658c7501 scsi: lpfc: Fix buffer free/clear order in deferred receive path
commit 9dba9a45c3 upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-09-09 18:54:17 +02:00
..
aacraid scsi: aacraid: Stop using PCI_IRQ_AFFINITY 2025-08-28 16:26:02 +02:00
aic7xxx
aic94xx
arcmsr
arm
be2iscsi
bfa scsi: bfa: Double-free fix 2025-08-28 16:25:59 +02:00
bnx2fc
bnx2i
csiostor
cxgbi
cxlflash
device_handler
elx scsi: elx: efct: Fix dma_unmap_sg() nents value 2025-08-15 12:05:03 +02:00
esas2r
fcoe
fnic
hisi_sas
ibmvscsi
ibmvscsi_tgt scsi: ibmvscsi_tgt: Fix dma_unmap_sg() nents value 2025-08-15 12:05:03 +02:00
isci scsi: isci: Fix dma_unmap_sg() nents value 2025-08-15 12:05:03 +02:00
libfc
libsas
lpfc scsi: lpfc: Fix buffer free/clear order in deferred receive path 2025-09-09 18:54:17 +02:00
megaraid scsi: megaraid_sas: Fix invalid node index 2025-07-06 10:58:01 +02:00
mpi3mr scsi: mpi3mr: Serialize admin queue BAR writes on 32-bit systems 2025-08-28 16:26:15 +02:00
mpt3sas scsi: mpt3sas: Correctly handle ATA device errors 2025-08-28 16:26:00 +02:00
mvsas scsi: mvsas: Fix dma_unmap_sg() nents value 2025-08-15 12:05:03 +02:00
pcmcia
pm8001
qedf
qedi
qla2xxx scsi: qla2xxx: Fix DMA mapping test in qla24xx_get_port_database() 2025-07-10 15:59:46 +02:00
qla4xxx scsi: qla4xxx: Prevent a potential error pointer dereference 2025-08-28 16:26:17 +02:00
smartpqi
snic
sym53c8xx_2
.gitignore
3w-9xxx.c
3w-9xxx.h
3w-sas.c
3w-sas.h
3w-xxxx.c
3w-xxxx.h
53c700_d.h_shipped
53c700.c
53c700.h
53c700.scr
a100u2w.c
a100u2w.h
a2091.c
a2091.h
a3000.c
a3000.h
a4000t.c
advansys.c
aha152x.c
aha152x.h
aha1542.c
aha1542.h
aha1740.c
aha1740.h
am53c974.c
atari_scsi.c
atp870u.c
atp870u.h
BusLogic.c
BusLogic.h
bvme6000_scsi.c
ch.c
constants.c
dc395x.c
dc395x.h
dmx3191d.c
esp_scsi.c
esp_scsi.h
fdomain_isa.c
fdomain_pci.c
fdomain.c
fdomain.h
FlashPoint.c
g_NCR5380.c
gvp11.c
gvp11.h
hosts.c
hpsa_cmd.h
hpsa.c
hpsa.h
hptiop.c
hptiop.h
imm.c
imm.h
initio.c
initio.h
ipr.c
ipr.h
ips.c
ips.h
iscsi_boot_sysfs.c
iscsi_tcp.c
iscsi_tcp.h
jazz_esp.c
Kconfig
lasi700.c
libiscsi_tcp.c
libiscsi.c scsi: libiscsi: Initialize iscsi_conn->dd_data only if memory is allocated 2025-08-28 16:25:59 +02:00
mac53c94.c
mac53c94.h
mac_esp.c
mac_scsi.c
Makefile
megaraid.c
megaraid.h
mesh.c
mesh.h
mvme16x_scsi.c
mvme147.c
mvme147.h
mvumi.c
mvumi.h
myrb.c
myrb.h
myrs.c
myrs.h
ncr53c8xx.c
ncr53c8xx.h
NCR5380.c
NCR5380.h
nsp32_debug.c
nsp32_io.h
nsp32.c
nsp32.h
pmcraid.c
pmcraid.h
ppa.c
ppa.h
ps3rom.c
qla1280.c
qla1280.h
qlogicfas408.c
qlogicfas408.h
qlogicfas.c
qlogicpti.c
qlogicpti.h
raid_class.c
script_asm.pl
scsi_bsg.c
scsi_common.c
scsi_debug.c
scsi_debugfs.c
scsi_debugfs.h
scsi_devinfo.c
scsi_dh.c
scsi_error.c
scsi_ioctl.c
scsi_lib_dma.c
scsi_lib.c
scsi_logging.c
scsi_logging.h
scsi_netlink.c
scsi_pm.c
scsi_priv.h
scsi_proc.c
scsi_sas_internal.h
scsi_scan.c scsi: Fix sas_user_scan() to handle wildcard and multi-channel scans 2025-08-28 16:26:02 +02:00
scsi_sysctl.c
scsi_sysfs.c scsi: core: sysfs: Correct sysfs attributes access rights 2025-09-04 15:26:25 +02:00
scsi_trace.c
scsi_transport_api.h
scsi_transport_fc.c
scsi_transport_iscsi.c scsi: Revert "scsi: iscsi: Fix HW conn removal use after free" 2025-08-15 12:05:07 +02:00
scsi_transport_sas.c scsi: Fix sas_user_scan() to handle wildcard and multi-channel scans 2025-08-28 16:26:02 +02:00
scsi_transport_spi.c
scsi_transport_srp.c
scsi.c
scsicam.c
sd_dif.c
sd_zbc.c
sd.c scsi: sd: Make sd shutdown issue START STOP UNIT appropriately 2025-08-15 12:05:08 +02:00
sd.h
sense_codes.h
ses.c
sg.c
sgiwd93.c
sim710.c
sni_53c710.c
sr_ioctl.c
sr_vendor.c
sr.c
sr.h
st_options.h
st.c
st.h
stex.c
storvsc_drv.c
sun3_scsi_vme.c
sun3_scsi.c
sun3x_esp.c
sun_esp.c
virtio_scsi.c
vmw_pvscsi.c
vmw_pvscsi.h
wd33c93.c
wd33c93.h
wd719x.c
wd719x.h
xen-scsifront.c
zalon.c
zorro7xx.c
zorro_esp.c