netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net 0/2] net/smc: fixes 2019-06-26
@ 2019-06-26 15:47 Ursula Braun
  2019-06-26 15:47 ` [PATCH net 1/2] net/smc: hold conns_lock before calling smc_lgr_register_conn() Ursula Braun
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Ursula Braun @ 2019-06-26 15:47 UTC (permalink / raw)
  To: davem
  Cc: netdev, linux-s390, gor, heiko.carstens, raspl, kgraul, ubraun,
	zhp, yuehaibing

Dave,

here are 2 small smc fixes for the net tree.

Thanks, Ursula

Huaping Zhou (1):
  net/smc: hold conns_lock before calling smc_lgr_register_conn()

YueHaibing (1):
  net/smc: Fix error path in smc_init

 net/smc/af_smc.c   | 5 ++++-
 net/smc/smc_core.c | 3 +++
 2 files changed, 7 insertions(+), 1 deletion(-)

-- 
2.17.1


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

* [PATCH net 1/2] net/smc: hold conns_lock before calling smc_lgr_register_conn()
  2019-06-26 15:47 [PATCH net 0/2] net/smc: fixes 2019-06-26 Ursula Braun
@ 2019-06-26 15:47 ` Ursula Braun
  2019-06-26 15:47 ` [PATCH net 2/2] net/smc: Fix error path in smc_init Ursula Braun
  2019-06-26 17:10 ` [PATCH net 0/2] net/smc: fixes 2019-06-26 David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Ursula Braun @ 2019-06-26 15:47 UTC (permalink / raw)
  To: davem
  Cc: netdev, linux-s390, gor, heiko.carstens, raspl, kgraul, ubraun,
	zhp, yuehaibing

From: Huaping Zhou <zhp@smail.nju.edu.cn>

After smc_lgr_create(), the newly created link group is added
to smc_lgr_list, thus is accessible from other context.
Although link group creation is serialized by
smc_create_lgr_pending, the new link group may still be accessed
concurrently. For example, if ib_device is no longer active,
smc_ib_port_event_work() will call smc_port_terminate(), which
in turn will call __smc_lgr_terminate() on every link group of
this device. So conns_lock is required here.

Signed-off-by: Huaping Zhou <zhp@smail.nju.edu.cn>
Signed-off-by: Ursula Braun <ubraun@linux.ibm.com>
---
 net/smc/smc_core.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/smc/smc_core.c b/net/smc/smc_core.c
index 2d2850adc2a3..4ca50ddf8d16 100644
--- a/net/smc/smc_core.c
+++ b/net/smc/smc_core.c
@@ -652,7 +652,10 @@ int smc_conn_create(struct smc_sock *smc, struct smc_init_info *ini)
 		rc = smc_lgr_create(smc, ini);
 		if (rc)
 			goto out;
+		lgr = conn->lgr;
+		write_lock_bh(&lgr->conns_lock);
 		smc_lgr_register_conn(conn); /* add smc conn to lgr */
+		write_unlock_bh(&lgr->conns_lock);
 	}
 	conn->local_tx_ctrl.common.type = SMC_CDC_MSG_TYPE;
 	conn->local_tx_ctrl.len = SMC_WR_TX_SIZE;
-- 
2.17.1


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

* [PATCH net 2/2] net/smc: Fix error path in smc_init
  2019-06-26 15:47 [PATCH net 0/2] net/smc: fixes 2019-06-26 Ursula Braun
  2019-06-26 15:47 ` [PATCH net 1/2] net/smc: hold conns_lock before calling smc_lgr_register_conn() Ursula Braun
@ 2019-06-26 15:47 ` Ursula Braun
  2019-06-26 17:10 ` [PATCH net 0/2] net/smc: fixes 2019-06-26 David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Ursula Braun @ 2019-06-26 15:47 UTC (permalink / raw)
  To: davem
  Cc: netdev, linux-s390, gor, heiko.carstens, raspl, kgraul, ubraun,
	zhp, yuehaibing

From: YueHaibing <yuehaibing@huawei.com>

If register_pernet_subsys success in smc_init,
we should cleanup it in case any other error.

Fixes: 64e28b52c7a6 (net/smc: add pnet table namespace support")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Ursula Braun <ubraun@linux.ibm.com>
---
 net/smc/af_smc.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c
index 0c874e996f85..7621ec2f539c 100644
--- a/net/smc/af_smc.c
+++ b/net/smc/af_smc.c
@@ -2029,7 +2029,7 @@ static int __init smc_init(void)
 
 	rc = smc_pnet_init();
 	if (rc)
-		return rc;
+		goto out_pernet_subsys;
 
 	rc = smc_llc_init();
 	if (rc) {
@@ -2080,6 +2080,9 @@ static int __init smc_init(void)
 	proto_unregister(&smc_proto);
 out_pnet:
 	smc_pnet_exit();
+out_pernet_subsys:
+	unregister_pernet_subsys(&smc_net_ops);
+
 	return rc;
 }
 
-- 
2.17.1


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

* Re: [PATCH net 0/2] net/smc: fixes 2019-06-26
  2019-06-26 15:47 [PATCH net 0/2] net/smc: fixes 2019-06-26 Ursula Braun
  2019-06-26 15:47 ` [PATCH net 1/2] net/smc: hold conns_lock before calling smc_lgr_register_conn() Ursula Braun
  2019-06-26 15:47 ` [PATCH net 2/2] net/smc: Fix error path in smc_init Ursula Braun
@ 2019-06-26 17:10 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2019-06-26 17:10 UTC (permalink / raw)
  To: ubraun
  Cc: netdev, linux-s390, gor, heiko.carstens, raspl, kgraul, zhp, yuehaibing

From: Ursula Braun <ubraun@linux.ibm.com>
Date: Wed, 26 Jun 2019 17:47:48 +0200

> here are 2 small smc fixes for the net tree.

Looks good, series applied, thanks.

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

end of thread, other threads:[~2019-06-26 17:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-26 15:47 [PATCH net 0/2] net/smc: fixes 2019-06-26 Ursula Braun
2019-06-26 15:47 ` [PATCH net 1/2] net/smc: hold conns_lock before calling smc_lgr_register_conn() Ursula Braun
2019-06-26 15:47 ` [PATCH net 2/2] net/smc: Fix error path in smc_init Ursula Braun
2019-06-26 17:10 ` [PATCH net 0/2] net/smc: fixes 2019-06-26 David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).