net/smc: fixes 2019-06-26
cover net/smc: fixes 2019-06-26
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(-)
Signature · 1 line
2.17.1
PATCH 1/2 net/smc: hold conns_lock before calling smc_lgr_register_conn()
From: Huaping Zhou <[email protected]>
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.
--- net/smc/smc_core.c | 3 +++ 1 file changed, 3 insertions(+)
net/smc/smc_core.c +3 -0
@@ -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 ;
Signature · 1 line
2.17.1
PATCH 2/2 net/smc: Fix error path in smc_init
In reply to Ursula BraunFrom: YueHaibing <[email protected]>
If register_pernet_subsys success in smc_init,
we should cleanup it in case any other error.
--- net/smc/af_smc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
net/smc/af_smc.c +4 -1
@@ -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; }
Signature · 1 line
2.17.1
David Miller
maintainerFrom: Ursula Braun <[email protected]>
Date: Wed, 26 Jun 2019 17:47:48 +0200
Quoted 1 line
here are 2 small smc fixes for the net tree.
Looks good, series applied, thanks.