Skip to contentSkip to conversation

net: openvswitch: fixes crash if nf_conncount_init() fails

PATCH Applied Eelco Chaudron 3 participants 3 messages Aug 31, 2020 – Sep 1, 2020

Subsystems (3)
lore
Share & tools
lore

Eelco Chaudron

author maintainer
#0 lore raw

PATCH 1/1 net: openvswitch: fixes crash if nf_conncount_init() fails

If nf_conncount_init fails currently the dispatched work is not canceled, causing problems when the timer fires. This change fixes this by not scheduling the work until all initialization is successful.

Fixes a65878d6f00b ("net: openvswitch: fixes potential deadlock in dp cleanup code")
---
 net/openvswitch/datapath.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
net/openvswitch/datapath.c +7 -1
index 6e47ef7ef036..78941822119f 100644
@@ -2476,13 +2476,19 @@ static int __init dp_register_genl(void)
 static int __net_init ovs_init_net(struct net *net)
 {
 	struct ovs_net *ovs_net = net_generic(net, ovs_net_id);
+	int err;
 
 	INIT_LIST_HEAD(&ovs_net->dps);
 	INIT_WORK(&ovs_net->dp_notify_work, ovs_dp_notify_wq);
 	INIT_DELAYED_WORK(&ovs_net->masks_rebalance, ovs_dp_masks_rebalance);
+
+	err = ovs_ct_init(net);
+	if (err)
+		return err;
+
 	schedule_delayed_work(&ovs_net->masks_rebalance,
 			      msecs_to_jiffies(DP_MASKS_REBALANCE_INTERVAL));
-	return ovs_ct_init(net);
+	return 0;
 }
 
 static void __net_exit list_vports_from_net(struct net *net, struct net *dnet,
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Eelco Chaudron

If nf_conncount_init fails currently the dispatched work is not canceled, causing problems when the timer fires. This change fixes this by not scheduling the work until all initialization is successful.

Fixes a65878d6f00b ("net: openvswitch: fixes potential deadlock in dp cleanup code")
Quoted 34 lines
---
 net/openvswitch/datapath.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
net/openvswitch/datapath.c +7 -1
index 6e47ef7ef036..78941822119f 100644
@@ -2476,13 +2476,19 @@ static int __init dp_register_genl(void)
 static int __net_init ovs_init_net(struct net *net)
 {
        struct ovs_net *ovs_net = net_generic(net, ovs_net_id);
+       int err;
 
        INIT_LIST_HEAD(&ovs_net->dps);
        INIT_WORK(&ovs_net->dp_notify_work, ovs_dp_notify_wq);
        INIT_DELAYED_WORK(&ovs_net->masks_rebalance, ovs_dp_masks_rebalance);
+
+       err = ovs_ct_init(net);
+       if (err)
+               return err;
+
        schedule_delayed_work(&ovs_net->masks_rebalance,
                              msecs_to_jiffies(DP_MASKS_REBALANCE_INTERVAL));
-       return ovs_ct_init(net);
+       return 0;
 }
 
 static void __net_exit list_vports_from_net(struct net *net, struct net *dnet,

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Signature · 1 line
Best regards, Tonghao
maintainer Applied
#2 lore raw
In reply to Eelco Chaudron

From: Eelco Chaudron <[email protected]>
Date: Mon, 31 Aug 2020 11:57:57 +0200

Quoted 7 lines

If nf_conncount_init fails currently the dispatched work is not canceled, causing problems when the timer fires. This change fixes this by not scheduling the work until all initialization is successful.

Fixes a65878d6f00b ("net: openvswitch: fixes potential deadlock in dp cleanup code")

Applied, thank you.