summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorWen Gu <guwen@linux.alibaba.com>2021-11-15 12:45:07 +0300
committerDavid S. Miller <davem@davemloft.net>2021-11-15 17:42:24 +0300
commitcf4f5530bb55ef7d5a91036b26676643b80b1616 (patch)
tree2f0b4def1efc452c8e88cd31eab40a3d9f42b7b4 /net
parent938cca9e4109b30ee1d476904538225a825e54eb (diff)
downloadlinux-cf4f5530bb55ef7d5a91036b26676643b80b1616.tar.xz
net/smc: Make sure the link_id is unique
The link_id is supposed to be unique, but smcr_next_link_id() doesn't skip the used link_id as expected. So the patch fixes this. Fixes: 026c381fb477 ("net/smc: introduce link_idx for link group array") Signed-off-by: Wen Gu <guwen@linux.alibaba.com> Reviewed-by: Tony Lu <tonylu@linux.alibaba.com> Acked-by: Karsten Graul <kgraul@linux.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/smc/smc_core.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/net/smc/smc_core.c b/net/smc/smc_core.c
index 49b8ba3bb683..25ebd30feecd 100644
--- a/net/smc/smc_core.c
+++ b/net/smc/smc_core.c
@@ -708,13 +708,14 @@ static u8 smcr_next_link_id(struct smc_link_group *lgr)
int i;
while (1) {
+again:
link_id = ++lgr->next_link_id;
if (!link_id) /* skip zero as link_id */
link_id = ++lgr->next_link_id;
for (i = 0; i < SMC_LINKS_PER_LGR_MAX; i++) {
if (smc_link_usable(&lgr->lnk[i]) &&
lgr->lnk[i].link_id == link_id)
- continue;
+ goto again;
}
break;
}