Skip to content

Commit cf4f553

Browse files
Wen Gudavem330
authored andcommitted
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: 026c381 ("net/smc: introduce link_idx for link group array") Signed-off-by: Wen Gu <[email protected]> Reviewed-by: Tony Lu <[email protected]> Acked-by: Karsten Graul <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 938cca9 commit cf4f553

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

net/smc/smc_core.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -708,13 +708,14 @@ static u8 smcr_next_link_id(struct smc_link_group *lgr)
708708
int i;
709709

710710
while (1) {
711+
again:
711712
link_id = ++lgr->next_link_id;
712713
if (!link_id) /* skip zero as link_id */
713714
link_id = ++lgr->next_link_id;
714715
for (i = 0; i < SMC_LINKS_PER_LGR_MAX; i++) {
715716
if (smc_link_usable(&lgr->lnk[i]) &&
716717
lgr->lnk[i].link_id == link_id)
717-
continue;
718+
goto again;
718719
}
719720
break;
720721
}

0 commit comments

Comments
 (0)