mirror-linux/drivers/target
Maurizio Lombardi 84dc603739 scsi: target: iscsi: Fix use-after-free in iscsit_dec_session_usage_count()
In iscsit_dec_session_usage_count(), the function calls complete() while
holding the sess->session_usage_lock. Similar to the connection usage count
logic, the waiter signaled by complete() (e.g., in the session release
path) may wake up and free the iscsit_session structure immediately.

This creates a race condition where the current thread may attempt to
execute spin_unlock_bh() on a session structure that has already been
deallocated, resulting in a KASAN slab-use-after-free.

To resolve this, release the session_usage_lock before calling complete()
to ensure all dereferences of the sess pointer are finished before the
waiter is allowed to proceed with deallocation.

Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
Reported-by: Zhaojuan Guo <zguo@redhat.com>
Reviewed-by: Mike Christie <michael.christie@oracle.com>
Link: https://patch.msgid.link/20260112165352.138606-3-mlombard@redhat.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2026-01-16 23:02:15 -05:00
..
iscsi scsi: target: iscsi: Fix use-after-free in iscsit_dec_session_usage_count() 2026-01-16 23:02:15 -05:00
loopback scsi: target: tcm_loop: Fix segfault in tcm_loop_tpg_address_show() 2025-11-08 12:30:02 -05:00
sbp scsi: target: sbp: Remove KMSG_COMPONENT macro 2025-11-29 15:27:33 -05:00
tcm_fc scsi: target: Add WQ_PERCPU to alloc_workqueue() users 2025-11-12 21:28:27 -05:00
tcm_remote scsi: target: Add virtual remote target 2023-03-16 23:36:37 -04:00
Kconfig scsi: target: Add virtual remote target 2023-03-16 23:36:37 -04:00
Makefile scsi: target: Add virtual remote target 2023-03-16 23:36:37 -04:00
target_core_alua.c move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00
target_core_alua.h
target_core_configfs.c SCSI misc on 20251204 2025-12-05 19:56:50 -08:00
target_core_device.c Merge patch series "target: RW/num_cmds stats improvements" 2025-11-02 22:07:27 -05:00
target_core_fabric_configfs.c scsi: target: Move LUN stats to per-CPU 2025-11-02 22:06:12 -05:00
target_core_fabric_lib.c scsi: target: core: Generate correct identifiers for PR OUT transport IDs 2025-07-24 21:57:00 -04:00
target_core_file.c scsi: target: Rename target_configure_unmap_from_queue() 2025-11-02 21:40:01 -05:00
target_core_file.h
target_core_hba.c
target_core_iblock.c scsi: target: Add atomic support to target_core_iblock 2025-11-02 21:40:02 -05:00
target_core_iblock.h scsi: target: iblock: Allow iblock devices to be shared 2025-07-24 21:39:01 -04:00
target_core_internal.h scsi: target: Move LUN stats to per-CPU 2025-11-02 22:06:12 -05:00
target_core_pr.c SCSI misc on 20250806 2025-08-06 15:44:25 +03:00
target_core_pr.h
target_core_pscsi.c block: add a bio_init_inline helper 2025-09-09 07:31:59 -06:00
target_core_pscsi.h target: port block device access to file 2024-02-25 12:05:25 +01:00
target_core_rd.c scsi: target: Rename sbc_ops to exec_cmd_ops 2023-04-11 21:55:36 -04:00
target_core_rd.h
target_core_sbc.c scsi: target: Add WRITE_ATOMIC_16 handler 2025-11-02 21:40:02 -05:00
target_core_spc.c scsi: target: Add WRITE_ATOMIC_16 support to RSOC 2025-11-02 21:40:02 -05:00
target_core_stat.c scsi: target: Move LUN stats to per-CPU 2025-11-02 22:06:12 -05:00
target_core_tmr.c scsi: target: Fix multiple LUN_RESET handling 2023-03-24 17:32:23 -04:00
target_core_tpg.c scsi: target: Move LUN stats to per-CPU 2025-11-02 22:06:12 -05:00
target_core_transport.c scsi: target: Reset t_task_cdb pointer in error case 2025-11-29 15:06:12 -05:00
target_core_ua.c
target_core_ua.h
target_core_user.c treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00
target_core_xcopy.c scsi: target: Add WQ_PERCPU to alloc_workqueue() users 2025-11-12 21:28:27 -05:00
target_core_xcopy.h scsi: target: core: Change the way target_xcopy_do_work() sets restiction on max I/O 2022-11-24 02:16:19 +00:00