* [PATCH AUTOSEL 4.9 6/7] scsi: target: iscsi: Make sure the np under each tpg is unique
[not found] <20220203203651.5158-1-sashal@kernel.org>
@ 2022-02-03 20:36 ` Sasha Levin
0 siblings, 0 replies; only message in thread
From: Sasha Levin @ 2022-02-03 20:36 UTC (permalink / raw)
To: linux-kernel, stable
Cc: ZouMingzhe, Mike Christie, Martin K . Petersen, Sasha Levin,
linux-scsi, target-devel
From: ZouMingzhe <mingzhe.zou@easystack.cn>
[ 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>
---
drivers/target/iscsi/iscsi_target_tpg.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/target/iscsi/iscsi_target_tpg.c b/drivers/target/iscsi/iscsi_target_tpg.c
index 761b065a40bb3..b2a76ecb5789c 100644
--- a/drivers/target/iscsi/iscsi_target_tpg.c
+++ b/drivers/target/iscsi/iscsi_target_tpg.c
@@ -452,6 +452,9 @@ static bool iscsit_tpg_check_network_portal(
break;
}
spin_unlock(&tpg->tpg_np_lock);
+
+ if (match)
+ break;
}
spin_unlock(&tiqn->tiqn_tpg_lock);
--
2.34.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2022-02-03 20:39 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20220203203651.5158-1-sashal@kernel.org>
2022-02-03 20:36 ` [PATCH AUTOSEL 4.9 6/7] scsi: target: iscsi: Make sure the np under each tpg is unique Sasha Levin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).