]> git.baikalelectronics.ru Git - kernel.git/commit
net/smc: fix listen processing for SMC-Rv2
authorliuyacan <liuyacan@corp.netease.com>
Mon, 23 May 2022 05:50:56 +0000 (13:50 +0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 23 May 2022 09:08:33 +0000 (10:08 +0100)
commiteda6aff420d7098e0fe56a1e6cb1f5432e0056d2
tree55c13be43e0d6a09c50090d516f251f99cdbbfa6
parent80a16c03a2085dab19a685f91d0b021341239188
net/smc: fix listen processing for SMC-Rv2

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, but the latter may fail. Unfortunately, the caller
will only check the former. In this case, a NULL pointer reference
will occur in smc_clc_send_confirm_accept() when accessing
conn->rmb_desc.

This patch does two things:
1. Use the return code to determine whether V2 is available.
2. If the return code is NODEV, continue to check whether V1 is
available.

Fixes: a6a3a9b9e195 ("net/smc: add listen processing for SMC-Rv2")
Signed-off-by: liuyacan <liuyacan@corp.netease.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/smc/af_smc.c