This is a note to let you know that I've just added the patch titled net/smc: Make sure the link_id is unique to the 5.10-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: net-smc-make-sure-the-link_id-is-unique.patch and it can be found in the queue-5.10 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. commit fd83e696b3962af4c28459aa23795742e074813e Author: Wen Gu <guwen@xxxxxxxxxxxxxxxxx> Date: Mon Nov 15 17:45:07 2021 +0800 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 <guwen@xxxxxxxxxxxxxxxxx> Reviewed-by: Tony Lu <tonylu@xxxxxxxxxxxxxxxxx> Acked-by: Karsten Graul <kgraul@xxxxxxxxxxxxx> Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx> Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx> diff --git a/net/smc/smc_core.c b/net/smc/smc_core.c index c491dd8e67cda..109d790eaebe2 100644 --- a/net/smc/smc_core.c +++ b/net/smc/smc_core.c @@ -287,13 +287,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; }