From: Dan Carpenter dan.carpenter@oracle.com
mainline inclusion from mainline-v6.1-rc2 commit bdee15e8c58b450ad736a2b62ef8c7a12548b704 category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/IAGKJU
Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?i...
-------------------------------------------
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") Signed-off-by: Dan Carpenter dan.carpenter@oracle.com Reviewed-by: Wenjia Zhang wenjia@linux.ibm.com Signed-off-by: David S. Miller davem@davemloft.net Signed-off-by: Zhengchao Shao shaozhengchao@huawei.com --- net/smc/smc_core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/smc/smc_core.c b/net/smc/smc_core.c index ec30554eb4e4..3a5b6b05f05d 100644 --- a/net/smc/smc_core.c +++ b/net/smc/smc_core.c @@ -893,7 +893,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);