linux-stable/drivers/target
Maurizio Lombardi cf1738fbaa scsi: target: iscsi: Prevent login threads from racing between each other
[ Upstream commit 2a737d3b8c ]

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 11:14:18 +02:00
..
iscsi scsi: target: iscsi: Prevent login threads from racing between each other 2023-06-28 11:14:18 +02:00
loopback scsi: target: tcm_loop: Fix possible name leak in tcm_loop_setup_hba_bus() 2022-11-17 17:46:16 +00:00
sbp scsi: target: sbp: Replace enable attr with ops.enable 2021-10-04 23:27:38 -04:00
tcm_fc
Kconfig
Makefile
target_core_alua.c scsi: target: alua: Do not report emtpy port group 2022-09-15 21:42:44 -04:00
target_core_alua.h
target_core_configfs.c scsi: target: core: Send max transfer length in blocks 2022-11-24 02:16:19 +00:00
target_core_device.c scsi: target: Fix multiple LUN_RESET handling 2023-05-11 23:17:14 +09:00
target_core_fabric_configfs.c scsi: target: Use kstrtobool() instead of strtobool() 2022-11-08 03:53:37 +00:00
target_core_fabric_lib.c
target_core_file.c target: use bvec_set_page to initialize bvecs 2023-02-03 08:20:55 -07:00
target_core_file.h
target_core_hba.c
target_core_iblock.c SCSI misc on 20221213 2022-12-14 08:58:51 -08:00
target_core_iblock.h
target_core_internal.h scsi: target: Move cmd counter allocation 2023-05-11 23:17:13 +09:00
target_core_pr.c scsi: target: core: New key must be used for moved PR 2022-10-01 05:03:57 -04:00
target_core_pr.h
target_core_pscsi.c scsi: target: target_core_pscsi: Convert to scsi_execute_cmd() 2023-01-13 21:34:09 -05:00
target_core_pscsi.h scsi: target: pscsi: Remove struct pscsi_plugin_task 2022-03-01 22:21:49 -05:00
target_core_rd.c
target_core_rd.h
target_core_sbc.c scsi: target: core: Fix hard lockup when executing a compare-and-write command 2022-11-24 03:22:58 +00:00
target_core_spc.c scsi: target: core: Send max transfer length in blocks 2022-11-24 02:16:19 +00:00
target_core_stat.c scsi: target: core: De-RCU of se_lun and se_lun acl 2022-08-01 19:36:02 -04:00
target_core_tmr.c scsi: target: Fix multiple LUN_RESET handling 2023-05-11 23:17:14 +09:00
target_core_tpg.c scsi: target: Move sess cmd counter to new struct 2023-05-11 23:17:13 +09:00
target_core_transport.c scsi: target: core: Fix error path in target_setup_session() 2023-06-21 16:02:18 +02:00
target_core_ua.c
target_core_ua.h
target_core_user.c mm: replace vma->vm_flags direct modifications with modifier calls 2023-02-09 16:51:39 -08:00
target_core_xcopy.c scsi: target: Pass in cmd counter to use during cmd setup 2023-05-11 23:17:13 +09: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