android_kernel_xiaomi_sm8450/drivers/target
Maurizio Lombardi 2b43198de0 scsi: target: iscsi: Prevent login threads from racing between each other
[ Upstream commit 2a737d3b8c792400118d6cf94958f559de9c5e59 ]

The tpg->np_login_sem is a semaphore that is used to serialize the login
process when multiple login threads run concurrently against the same
target portal group.

The iscsi_target_locate_portal() function finds the tpg, calls
iscsit_access_np() against the np_login_sem semaphore and saves the tpg
pointer in conn->tpg;

If iscsi_target_locate_portal() fails, the caller will check for the
conn->tpg pointer and, if it's not NULL, then it will assume that
iscsi_target_locate_portal() called iscsit_access_np() on the semaphore.

Make sure that conn->tpg gets initialized only if iscsit_access_np() was
successful, otherwise iscsit_deaccess_np() may end up being called against
a semaphore we never took, allowing more than one thread to access the same
tpg.

Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
Link: https://lore.kernel.org/r/20230508162219.1731964-4-mlombard@redhat.com
Reviewed-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-06-28 10:28:14 +02:00
..
iscsi scsi: target: iscsi: Prevent login threads from racing between each other 2023-06-28 10:28:14 +02:00
loopback scsi: target: tcm_loop: Fix possible name leak in tcm_loop_setup_hba_bus() 2022-11-25 17:45:55 +01:00
sbp
tcm_fc scsi: target: Make state_list per CPU 2023-05-17 11:47:48 +02:00
Kconfig
Makefile
target_core_alua.c scsi: target: Fix alua_tg_pt_gps_count tracking 2021-11-26 10:39:11 +01:00
target_core_alua.h
target_core_configfs.c scsi: target: Fix the pgr/alua_support_store functions 2021-09-30 10:11:03 +02:00
target_core_device.c scsi: target: Fix multiple LUN_RESET handling 2023-05-17 11:47:48 +02:00
target_core_fabric_configfs.c
target_core_fabric_lib.c
target_core_file.c fix iov_iter_bvec() "direction" argument 2023-02-15 17:22:11 +01:00
target_core_file.h
target_core_hba.c
target_core_iblock.c
target_core_iblock.h
target_core_internal.h scsi: target: Fix ordered tag handling 2021-11-26 10:39:11 +01:00
target_core_pr.c
target_core_pr.h
target_core_pscsi.c scsi: target: pscsi: Fix warning in pscsi_complete_cmd() 2021-05-11 14:47:23 +02:00
target_core_pscsi.h
target_core_rd.c
target_core_rd.h
target_core_sbc.c scsi: target: Rename cmd.bad_sector to cmd.sense_info 2023-05-17 11:47:48 +02:00
target_core_spc.c
target_core_stat.c
target_core_tmr.c scsi: target: Fix multiple LUN_RESET handling 2023-05-17 11:47:48 +02:00
target_core_tpg.c
target_core_transport.c scsi: target: core: Avoid smp_processor_id() in preemptible code 2023-05-17 11:48:08 +02:00
target_core_ua.c
target_core_ua.h
target_core_user.c scsi: target: tcmu: Fix possible page UAF 2022-04-20 09:23:21 +02:00
target_core_xcopy.c
target_core_xcopy.h