From: Nicolas Dichtel <nicolas.dichtel@6wind.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, pshelar@ovn.org, jesse@kernel.org,
linville@tuxdriver.com,
Nicolas Dichtel <nicolas.dichtel@6wind.com>,
David Wragg <david@weave.works>
Subject: [PATCH net v2 1/4] ovs/gre,geneve: fix error path when creating an iface
Date: Mon, 13 Jun 2016 10:31:04 +0200 [thread overview]
Message-ID: <1465806667-23148-2-git-send-email-nicolas.dichtel@6wind.com> (raw)
In-Reply-To: <1465806667-23148-1-git-send-email-nicolas.dichtel@6wind.com>
After ipgre_newlink()/geneve_configure() call, the netdev is registered.
Fixes: 7e059158d57b ("vxlan, gre, geneve: Set a large MTU on ovs-created tunnel devices")
CC: David Wragg <david@weave.works>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
---
drivers/net/geneve.c | 10 +++++++---
net/ipv4/ip_gre.c | 10 +++++++---
2 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c
index cadefe4fdaa2..086c2dae4c3d 100644
--- a/drivers/net/geneve.c
+++ b/drivers/net/geneve.c
@@ -1508,6 +1508,7 @@ struct net_device *geneve_dev_create_fb(struct net *net, const char *name,
{
struct nlattr *tb[IFLA_MAX + 1];
struct net_device *dev;
+ LIST_HEAD(list_kill);
int err;
memset(tb, 0, sizeof(tb));
@@ -1519,8 +1520,10 @@ struct net_device *geneve_dev_create_fb(struct net *net, const char *name,
err = geneve_configure(net, dev, &geneve_remote_unspec,
0, 0, 0, 0, htons(dst_port), true,
GENEVE_F_UDP_ZERO_CSUM6_RX);
- if (err)
- goto err;
+ if (err) {
+ free_netdev(dev);
+ return ERR_PTR(err);
+ }
/* openvswitch users expect packet sizes to be unrestricted,
* so set the largest MTU we can.
@@ -1532,7 +1535,8 @@ struct net_device *geneve_dev_create_fb(struct net *net, const char *name,
return dev;
err:
- free_netdev(dev);
+ geneve_dellink(dev, &list_kill);
+ unregister_netdevice_many(&list_kill);
return ERR_PTR(err);
}
EXPORT_SYMBOL_GPL(geneve_dev_create_fb);
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index 4d2025f7ec57..08deba679c8c 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -1121,6 +1121,7 @@ struct net_device *gretap_fb_dev_create(struct net *net, const char *name,
{
struct nlattr *tb[IFLA_MAX + 1];
struct net_device *dev;
+ LIST_HEAD(list_kill);
struct ip_tunnel *t;
int err;
@@ -1136,8 +1137,10 @@ struct net_device *gretap_fb_dev_create(struct net *net, const char *name,
t->collect_md = true;
err = ipgre_newlink(net, dev, tb, NULL);
- if (err < 0)
- goto out;
+ if (err < 0) {
+ free_netdev(dev);
+ return ERR_PTR(err);
+ }
/* openvswitch users expect packet sizes to be unrestricted,
* so set the largest MTU we can.
@@ -1148,7 +1151,8 @@ struct net_device *gretap_fb_dev_create(struct net *net, const char *name,
return dev;
out:
- free_netdev(dev);
+ ip_tunnel_dellink(dev, &list_kill);
+ unregister_netdevice_many(&list_kill);
return ERR_PTR(err);
}
EXPORT_SYMBOL_GPL(gretap_fb_dev_create);
--
2.4.2
next prev parent reply other threads:[~2016-06-13 8:31 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-10 9:32 [PATCH net 1/2] ovs/vxlan: fix rtnl notifications on iface deletion Nicolas Dichtel
2016-06-10 9:32 ` [PATCH net 2/2] ovs/gre: " Nicolas Dichtel
2016-06-10 17:50 ` pravin shelar
2016-06-10 17:50 ` [PATCH net 1/2] ovs/vxlan: " pravin shelar
2016-06-13 7:44 ` Nicolas Dichtel
2016-06-13 8:31 ` [PATCH net v2 0/4] ovs: fix rtnl notifications on interface deletion Nicolas Dichtel
2016-06-13 8:31 ` Nicolas Dichtel [this message]
2016-06-13 8:31 ` [PATCH net v2 2/4] ovs/vxlan: fix rtnl notifications on iface deletion Nicolas Dichtel
2016-06-13 8:31 ` [PATCH net v2 3/4] ovs/gre: " Nicolas Dichtel
2016-06-13 8:31 ` [PATCH net v2 4/4] ovs/geneve: " Nicolas Dichtel
2016-06-13 19:39 ` [PATCH net v2 0/4] ovs: fix rtnl notifications on interface deletion pravin shelar
2016-06-15 5:22 ` David Miller
2016-06-10 17:52 ` [PATCH net 1/2] ovs/vxlan: fix rtnl notifications on iface deletion Jesse Gross
2016-06-13 8:12 ` Nicolas Dichtel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1465806667-23148-2-git-send-email-nicolas.dichtel@6wind.com \
--to=nicolas.dichtel@6wind.com \
--cc=davem@davemloft.net \
--cc=david@weave.works \
--cc=jesse@kernel.org \
--cc=linville@tuxdriver.com \
--cc=netdev@vger.kernel.org \
--cc=pshelar@ovn.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).