diff mbox series

[net] net/smc: Make sure the link_id is unique

Message ID 1636969507-39355-1-git-send-email-guwen@linux.alibaba.com (mailing list archive)
State Accepted
Commit cf4f5530bb55ef7d5a91036b26676643b80b1616
Delegated to: Netdev Maintainers
Headers show
Series [net] net/smc: Make sure the link_id is unique | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net
netdev/fixes_present success Fixes tag present in non-next series
netdev/subject_prefix success Link
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers fail 2 blamed authors not CCed: ubraun@linux.ibm.com davem@davemloft.net; 3 maintainers not CCed: kuba@kernel.org ubraun@linux.ibm.com davem@davemloft.net
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 15 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Wen Gu Nov. 15, 2021, 9:45 a.m. UTC
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>
---
 net/smc/smc_core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Karsten Graul Nov. 15, 2021, 1:33 p.m. UTC | #1
On 15/11/2021 10:45, Wen Gu wrote:
> 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>
> ---

Thank you.

Acked-by: Karsten Graul <kgraul@linux.ibm.com>
patchwork-bot+netdevbpf@kernel.org Nov. 15, 2021, 2:50 p.m. UTC | #2
Hello:

This patch was applied to netdev/net.git (master)
by David S. Miller <davem@davemloft.net>:

On Mon, 15 Nov 2021 17:45:07 +0800 you wrote:
> 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>
> 
> [...]

Here is the summary with links:
  - [net] net/smc: Make sure the link_id is unique
    https://git.kernel.org/netdev/net/c/cf4f5530bb55

You are awesome, thank you!
diff mbox series

Patch

diff --git a/net/smc/smc_core.c b/net/smc/smc_core.c
index 49b8ba3..25ebd30 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;
 	}