All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net 0/2] net/smc: fixes for -net
@ 2019-10-23 13:44 Karsten Graul
  2019-10-23 13:44 ` [PATCH net 1/2] net/smc: fix closing of fallback SMC sockets Karsten Graul
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Karsten Graul @ 2019-10-23 13:44 UTC (permalink / raw)
  To: davem; +Cc: netdev, linux-s390, heiko.carstens, raspl, ubraun

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(-)

-- 
2.17.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH net 1/2] net/smc: fix closing of fallback SMC sockets
  2019-10-23 13:44 [PATCH net 0/2] net/smc: fixes for -net Karsten Graul
@ 2019-10-23 13:44 ` Karsten Graul
  2019-10-23 13:44 ` [PATCH net 2/2] net/smc: keep vlan_id for SMC-R in smc_listen_work() Karsten Graul
  2019-10-26  2:18 ` [PATCH net 0/2] net/smc: fixes for -net David Miller
  2 siblings, 0 replies; 6+ messages in thread
From: Karsten Graul @ 2019-10-23 13:44 UTC (permalink / raw)
  To: davem; +Cc: netdev, linux-s390, heiko.carstens, raspl, ubraun

From: Ursula Braun <ubraun@linux.ibm.com>

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: 07603b230895 ("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>
---
 net/smc/af_smc.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c
index 5b932583e407..d9566e84f2f9 100644
--- a/net/smc/af_smc.c
+++ b/net/smc/af_smc.c
@@ -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);
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH net 2/2] net/smc: keep vlan_id for SMC-R in smc_listen_work()
  2019-10-23 13:44 [PATCH net 0/2] net/smc: fixes for -net Karsten Graul
  2019-10-23 13:44 ` [PATCH net 1/2] net/smc: fix closing of fallback SMC sockets Karsten Graul
@ 2019-10-23 13:44 ` Karsten Graul
  2019-10-26  2:18 ` [PATCH net 0/2] net/smc: fixes for -net David Miller
  2 siblings, 0 replies; 6+ messages in thread
From: Karsten Graul @ 2019-10-23 13:44 UTC (permalink / raw)
  To: davem; +Cc: netdev, linux-s390, heiko.carstens, raspl, ubraun

From: Ursula Braun <ubraun@linux.ibm.com>

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.

Fixes: bc36d2fc93eb ("net/smc: consolidate function parameters")
Signed-off-by: Ursula Braun <ubraun@linux.ibm.com>
Signed-off-by: Karsten Graul <kgraul@linux.ibm.com>
---
 net/smc/af_smc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c
index d9566e84f2f9..cea3c36ea0da 100644
--- a/net/smc/af_smc.c
+++ b/net/smc/af_smc.c
@@ -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) {
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH net 0/2] net/smc: fixes for -net
  2019-10-23 13:44 [PATCH net 0/2] net/smc: fixes for -net Karsten Graul
  2019-10-23 13:44 ` [PATCH net 1/2] net/smc: fix closing of fallback SMC sockets Karsten Graul
  2019-10-23 13:44 ` [PATCH net 2/2] net/smc: keep vlan_id for SMC-R in smc_listen_work() Karsten Graul
@ 2019-10-26  2:18 ` David Miller
  2 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2019-10-26  2:18 UTC (permalink / raw)
  To: kgraul; +Cc: netdev, linux-s390, heiko.carstens, raspl, ubraun

From: Karsten Graul <kgraul@linux.ibm.com>
Date: Wed, 23 Oct 2019 15:44:04 +0200

> 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.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net 0/2] net/smc: fixes for -net
  2020-02-14  7:58 Karsten Graul
@ 2020-02-14 15:14 ` David Miller
  0 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2020-02-14 15:14 UTC (permalink / raw)
  To: kgraul; +Cc: netdev, linux-s390, heiko.carstens, raspl, ubraun

From: Karsten Graul <kgraul@linux.ibm.com>
Date: Fri, 14 Feb 2020 08:58:58 +0100

> Fix a syzbot finding and a problem with the CLC handshake content.

Series applied, thank you.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH net 0/2] net/smc: fixes for -net
@ 2020-02-14  7:58 Karsten Graul
  2020-02-14 15:14 ` David Miller
  0 siblings, 1 reply; 6+ messages in thread
From: Karsten Graul @ 2020-02-14  7:58 UTC (permalink / raw)
  To: davem; +Cc: netdev, linux-s390, heiko.carstens, raspl, ubraun

Fix a syzbot finding and a problem with the CLC handshake content.

Ursula Braun (2):
  net/smc: transfer fasync_list in case of fallback
  net/smc: no peer ID in CLC decline for SMCD

 net/smc/af_smc.c  | 2 ++
 net/smc/smc_clc.c | 4 +++-
 2 files changed, 5 insertions(+), 1 deletion(-)

-- 
2.17.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-02-14 15:14 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-23 13:44 [PATCH net 0/2] net/smc: fixes for -net Karsten Graul
2019-10-23 13:44 ` [PATCH net 1/2] net/smc: fix closing of fallback SMC sockets Karsten Graul
2019-10-23 13:44 ` [PATCH net 2/2] net/smc: keep vlan_id for SMC-R in smc_listen_work() Karsten Graul
2019-10-26  2:18 ` [PATCH net 0/2] net/smc: fixes for -net David Miller
2020-02-14  7:58 Karsten Graul
2020-02-14 15:14 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.