diff options
author | ZouMingzhe <mingzhe.zou@easystack.cn> | 2022-01-11 13:47:42 +0800 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2022-01-24 23:30:24 -0500 |
commit | a861790afaa8b6369eee8a88c5d5d73f5799c0c6 (patch) | |
tree | 38160df95c5b34b56d6f8b28c77c9254e4d9d73d /drivers/target/iscsi | |
parent | 61263b3a11a2594b4e898f166c31162236182b5c (diff) | |
download | linux-stable-a861790afaa8b6369eee8a88c5d5d73f5799c0c6.tar.gz linux-stable-a861790afaa8b6369eee8a88c5d5d73f5799c0c6.tar.bz2 linux-stable-a861790afaa8b6369eee8a88c5d5d73f5799c0c6.zip |
scsi: target: iscsi: Make sure the np under each tpg is unique
iscsit_tpg_check_network_portal() has nested for_each loops and is supposed
to return true when a match is found. However, the tpg loop will still
continue after existing the tpg_np loop. If this tpg_np is not the last the
match value will be changed.
Break the outer loop after finding a match and make sure the np under each
tpg is unique.
Link: https://lore.kernel.org/r/20220111054742.19582-1-mingzhe.zou@easystack.cn
Signed-off-by: ZouMingzhe <mingzhe.zou@easystack.cn>
Reviewed-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/target/iscsi')
-rw-r--r-- | drivers/target/iscsi/iscsi_target_tpg.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/target/iscsi/iscsi_target_tpg.c b/drivers/target/iscsi/iscsi_target_tpg.c index 8075f60fd02c..2d5cf1714ae0 100644 --- a/drivers/target/iscsi/iscsi_target_tpg.c +++ b/drivers/target/iscsi/iscsi_target_tpg.c @@ -443,6 +443,9 @@ static bool iscsit_tpg_check_network_portal( break; } spin_unlock(&tpg->tpg_np_lock); + + if (match) + break; } spin_unlock(&tiqn->tiqn_tpg_lock); |