This is a note to let you know that I've just added the patch titled net/smc: set ini->smcrv2.ib_dev_v2 to NULL if SMC-Rv2 is unavailable to the 5.18-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: net-smc-set-ini-smcrv2.ib_dev_v2-to-null-if-smc-rv2-.patch and it can be found in the queue-5.18 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. commit 46c0310e0eba21bd734014ade3b2f3d5cd2848fe Author: liuyacan <liuyacan@xxxxxxxxxxxxxxxx> Date: Wed May 25 16:54:08 2022 +0800 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 <liuyacan@xxxxxxxxxxxxxxxx> Reviewed-by: Karsten Graul <kgraul@xxxxxxxxxxxxx> Link: https://lore.kernel.org/r/20220525085408.812273-1-liuyacan@xxxxxxxxxxxxxxxx Signed-off-by: Jakub Kicinski <kuba@xxxxxxxxxx> Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx> diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c index 45a24d24210f..540b32d86d9b 100644 --- a/net/smc/af_smc.c +++ b/net/smc/af_smc.c @@ -2136,6 +2136,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; }