From: liuyacan Date: Wed, 25 May 2022 08:54:08 +0000 (+0800) Subject: net/smc: set ini->smcrv2.ib_dev_v2 to NULL if SMC-Rv2 is unavailable X-Git-Tag: v5.17.15~225 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d4057803a84112ffd17535fa535d74bf69c3b969;p=thirdparty%2Fkernel%2Fstable.git net/smc: set ini->smcrv2.ib_dev_v2 to NULL if SMC-Rv2 is unavailable [ Upstream commit b3b1a17538d3ef6a9667b2271216fd16d7678ab5 ] In the process of checking whether RDMAv2 is available, the current implementation first sets ini->smcrv2.ib_dev_v2, and then allocates smc buf desc and register rmb, but the latter may fail. In this case, the pointer should be reset. Fixes: e49300a6bf62 ("net/smc: add listen processing for SMC-Rv2") Signed-off-by: liuyacan Reviewed-by: Karsten Graul Link: https://lore.kernel.org/r/20220525085408.812273-1-liuyacan@corp.netease.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c index b9fe31834354d..4bc6b16669f35 100644 --- a/net/smc/af_smc.c +++ b/net/smc/af_smc.c @@ -1973,6 +1973,7 @@ static void smc_find_rdma_v2_device_serv(struct smc_sock *new_smc, not_found: ini->smcr_version &= ~SMC_V2; + ini->smcrv2.ib_dev_v2 = NULL; ini->check_smcrv2 = false; }