]> git.baikalelectronics.ru Git - kernel.git/commit
net/smc: fix closing of fallback SMC sockets
authorUrsula Braun <ubraun@linux.ibm.com>
Wed, 23 Oct 2019 13:44:05 +0000 (15:44 +0200)
committerDavid S. Miller <davem@davemloft.net>
Sat, 26 Oct 2019 02:18:21 +0000 (19:18 -0700)
commit60a51bed070ce82d8f2f38ca7cdfe62aab493c8a
tree7fbe29b9602d336c4451a8b5bcc5f20686afb393
parentabd0f0eacc88cb5601d2b94e5a7c245a1c97dc1b
net/smc: fix closing of fallback SMC sockets

For SMC sockets forced to fallback to TCP, the file is propagated
from the outer SMC to the internal TCP socket. When closing the SMC
socket, the internal TCP socket file pointer must be restored to the
original NULL value, otherwise memory leaks may show up (found with
CONFIG_DEBUG_KMEMLEAK).

The internal TCP socket is released in smc_clcsock_release(), which
calls __sock_release() function in net/socket.c. This calls the
needed iput(SOCK_INODE(sock)) only, if the file pointer has been reset
to the original NULL-value.

Fixes: 5b9c80ac5fc2 ("net/smc: propagate file from SMC to TCP socket")
Signed-off-by: Ursula Braun <ubraun@linux.ibm.com>
Signed-off-by: Karsten Graul <kgraul@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/smc/af_smc.c