net/smc: fixes for -net
cover net/smc: fixes for -net
Fixes for the net tree, covering a memleak when closing SMC fallback sockets and fix SMC-R connection establishment when vlan-ids are used.
Ursula Braun (2):
net/smc: fix closing of fallback SMC sockets net/smc: keep vlan_id for SMC-R in smc_listen_work()
net/smc/af_smc.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
Signature · 1 line
2.17.1
PATCH 1/2 net/smc: fix closing of fallback SMC sockets
From: Ursula Braun <[email protected]>
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.
--- net/smc/af_smc.c | 7 +++++++ 1 file changed, 7 insertions(+)
net/smc/af_smc.c +7 -0
@@ -123,6 +123,12 @@ struct proto smc_proto6 = { };EXPORT_SYMBOL_GPL (smc_proto6); +static void smc_restore_fallback_changes (struct smc_sock *smc) +{ + smc->clcsock->file->private_data = smc->sk.sk_socket; + smc->clcsock->file =NULL ; +} +static int __smc_release (struct smc_sock *smc) {struct sock *sk = &smc->sk;
@@ -141,6 +147,7 @@ static int __smc_release(struct smc_sock *smc) } sk->sk_state =SMC_CLOSED ; sk->sk_state_change (sk); +smc_restore_fallback_changes (smc); } sk->sk_prot->unhash (sk);
Signature · 1 line
2.17.1
PATCH 2/2 net/smc: keep vlan_id for SMC-R in smc_listen_work()
In reply to Karsten GraulFrom: Ursula Braun <[email protected]>
Creating of an SMC-R connection with vlan-id fails, because smc_listen_work() determines the vlan_id of the connection, saves it in struct smc_init_info ini, but clears the ini area again if SMC-D is not applicable.
This patch just resets the ISM device before investigating SMC-R availability.
--- net/smc/af_smc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/smc/af_smc.c +1 -1
@@ -1298,8 +1298,8 @@ static void smc_listen_work(struct work_struct *work)/* check if RDMA is available */ if (!ism_supported) {/* SMC_TYPE_R or SMC_TYPE_B */ /* prepare RDMA check */ -memset (&ini,0 ,sizeof (ini)); ini.is_smcd = false; + ini.ism_dev =NULL ; ini.ib_lcl = &pclc->lcl; rc =smc_find_rdma_device (new_smc, &ini);if (rc) {
Signature · 1 line
2.17.1
David Miller
maintainerFrom: Karsten Graul <[email protected]>
Date: Wed, 23 Oct 2019 15:44:04 +0200
Quoted 3 lines
Fixes for the net tree, covering a memleak when closing SMC fallback sockets and fix SMC-R connection establishment when vlan-ids are used.
Series applied, thanks.