]> git.baikalelectronics.ru Git - kernel.git/commit
net/smc: Fix sock leak when release after smc_shutdown()
authorTony Lu <tonylu@linux.alibaba.com>
Thu, 14 Apr 2022 07:51:03 +0000 (15:51 +0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 15 Apr 2022 10:14:38 +0000 (11:14 +0100)
commit536a1a45c908e3b64a1259bc4b25a8422e2e9ed0
tree6078cb7bea897034844e2a2a0937c8e2ffe55fd9
parentdd1fb6e88a5f2767f182ee58c3911040ad8afd67
net/smc: Fix sock leak when release after smc_shutdown()

Since commit 8e0b121b4a1c ("net/smc: fix sk_refcnt underflow on linkdown
and fallback"), for a fallback connection, __smc_release() does not call
sock_put() if its state is already SMC_CLOSED.

When calling smc_shutdown() after falling back, its state is set to
SMC_CLOSED but does not call sock_put(), so this patch calls it.

Reported-and-tested-by: syzbot+6e29a053eb165bd50de5@syzkaller.appspotmail.com
Fixes: 8e0b121b4a1c ("net/smc: fix sk_refcnt underflow on linkdown and fallback")
Signed-off-by: Tony Lu <tonylu@linux.alibaba.com>
Acked-by: Karsten Graul <kgraul@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/smc/af_smc.c