summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZouMingzhe <mingzhe.zou@easystack.cn>2022-01-11 13:47:42 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-02-16 12:51:44 +0100
commitded80123b84253ecc6c6cfd1fbbbd99f51c984ec (patch)
tree6859fc4265138a5c814601e595120224f0f25998
parentf35b469de7344aa9184d78bff34ee48ad42bab1f (diff)
downloadlinux-stable-ded80123b84253ecc6c6cfd1fbbbd99f51c984ec.tar.gz
linux-stable-ded80123b84253ecc6c6cfd1fbbbd99f51c984ec.tar.bz2
linux-stable-ded80123b84253ecc6c6cfd1fbbbd99f51c984ec.zip
scsi: target: iscsi: Make sure the np under each tpg is unique
[ Upstream commit a861790afaa8b6369eee8a88c5d5d73f5799c0c6 ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--drivers/target/iscsi/iscsi_target_tpg.c3
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 101d62105c93..f3671ffdf149 100644
--- a/drivers/target/iscsi/iscsi_target_tpg.c
+++ b/drivers/target/iscsi/iscsi_target_tpg.c
@@ -451,6 +451,9 @@ static bool iscsit_tpg_check_network_portal(
break;
}
spin_unlock(&tpg->tpg_np_lock);
+
+ if (match)
+ break;
}
spin_unlock(&tiqn->tiqn_tpg_lock);