diff options
| author | 2023-05-08 18:22:19 +0200 | |
|---|---|---|
| committer | 2023-05-22 16:29:39 -0400 | |
| commit | 2a737d3b8c792400118d6cf94958f559de9c5e59 (patch) | |
| tree | 9cb285d2de6f933b26631433680762560a64fa8a /scripts/gdb/linux/vfs.py | |
| parent | scsi: target: iscsi: Remove unused transport_timer (diff) | |
| download | wireguard-linux-2a737d3b8c792400118d6cf94958f559de9c5e59.tar.xz wireguard-linux-2a737d3b8c792400118d6cf94958f559de9c5e59.zip | |
scsi: target: iscsi: Prevent login threads from racing between each other
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>
Diffstat (limited to 'scripts/gdb/linux/vfs.py')
0 files changed, 0 insertions, 0 deletions
