Skip to contentSkip to conversation

net/smc: Fix an error code in smc_lgr_create()

PATCH Applied Dan Carpenter 3 participants 3 messages Oct 14, 2022 – Oct 15, 2022

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/smc: Fix an error code in smc_lgr_create()

If smc_wr_alloc_lgr_mem() fails then return an error code. Don't return success.

Fixes 8799e310fb3f ("net/smc: add v2 support to the work request layer")
---
 net/smc/smc_core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
net/smc/smc_core.c +2 -1
index e6ee797640b4..c305d8dd23f8 100644
@@ -896,7 +896,8 @@ static int smc_lgr_create(struct smc_sock *smc, struct smc_init_info *ini)
 		}
 		memcpy(lgr->pnet_id, ibdev->pnetid[ibport - 1],
 		       SMC_MAX_PNETID_LEN);
-		if (smc_wr_alloc_lgr_mem(lgr))
+		rc = smc_wr_alloc_lgr_mem(lgr);
+		if (rc)
 			goto free_wq;
 		smc_llc_lgr_init(lgr, smc);
 
Signature · 1 line
2.35.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 14 lines · Dan Carpenter

If smc_wr_alloc_lgr_mem() fails then return an error code. Don't return success.

Fixes 8799e310fb3f ("net/smc: add v2 support to the work request layer")
---
  net/smc/smc_core.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
net/smc/smc_core.c +0 -0
index e6ee797640b4..c305d8dd23f8 100644

net/smc/smc_core.c static int smc_lgr_create(struct smc_sock *smc, struct smc_init_info *ini) · line 903

Quoted 9 lines
net/smc/smc_core.c +2 -1
@@ -896,7 +896,8 @@ static int smc_lgr_create(struct smc_sock *smc, struct smc_init_info *ini)
  		}
  		memcpy(lgr->pnet_id, ibdev->pnetid[ibport - 1],
  		       SMC_MAX_PNETID_LEN);
-		if (smc_wr_alloc_lgr_mem(lgr))
+		rc = smc_wr_alloc_lgr_mem(lgr);
+		if (rc)
  			goto free_wq;
  		smc_llc_lgr_init(lgr, smc);
 

Good catch! Thank you for your effort!

#2 lore raw
In reply to Dan Carpenter
This patch was applied to netdev/net.git (master) by David S. Miller <[email protected]>:

Hello:

This patch was applied to netdev/net.git (master)
by David S. Miller <[email protected]>:

Quoted 8 lines · On Fri, 14 Oct 2022 12:34:36 +0300 you wrote:

If smc_wr_alloc_lgr_mem() fails then return an error code. Don't return success.

Fixes 8799e310fb3f ("net/smc: add v2 support to the work request layer")
---
 net/smc/smc_core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Here is the summary with links:
- [net] net/smc: Fix an error code in smc_lgr_create()

    https://git.kernel.org/netdev/net/c/bdee15e8c58b

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html