mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-21 01:51:18 +00:00
net/smc: Make sure the link_id is unique
[ Upstream commitcf4f5530bb
] 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:026c381fb4
("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> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
17b2c2e70d
commit
f6218db543
1 changed files with 2 additions and 1 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue