From: Wen Gu Date: Mon, 15 Nov 2021 09:45:07 +0000 (+0800) Subject: net/smc: Make sure the link_id is unique X-Git-Tag: accepted/tizen/unified/20230118.172025~4998 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f6218db543517082b45f553b39f7731d6535126c;p=platform%2Fkernel%2Flinux-rpi.git net/smc: Make sure the link_id is unique [ Upstream commit cf4f5530bb55ef7d5a91036b26676643b80b1616 ] 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 Reviewed-by: Tony Lu Acked-by: Karsten Graul Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- diff --git a/net/smc/smc_core.c b/net/smc/smc_core.c index d220674..d672c0f 100644 --- a/net/smc/smc_core.c +++ b/net/smc/smc_core.c @@ -665,13 +665,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; }