diff options
-rw-r--r-- | net/ipv4/ip_gre.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c index 40f043915235..a77807d449e3 100644 --- a/net/ipv4/ip_gre.c +++ b/net/ipv4/ip_gre.c | |||
@@ -1290,16 +1290,19 @@ static const struct net_protocol ipgre_protocol = { | |||
1290 | .netns_ok = 1, | 1290 | .netns_ok = 1, |
1291 | }; | 1291 | }; |
1292 | 1292 | ||
1293 | static void ipgre_destroy_tunnels(struct ipgre_net *ign) | 1293 | static void ipgre_destroy_tunnels(struct ipgre_net *ign, struct list_head *head) |
1294 | { | 1294 | { |
1295 | int prio; | 1295 | int prio; |
1296 | 1296 | ||
1297 | for (prio = 0; prio < 4; prio++) { | 1297 | for (prio = 0; prio < 4; prio++) { |
1298 | int h; | 1298 | int h; |
1299 | for (h = 0; h < HASH_SIZE; h++) { | 1299 | for (h = 0; h < HASH_SIZE; h++) { |
1300 | struct ip_tunnel *t; | 1300 | struct ip_tunnel *t = ign->tunnels[prio][h]; |
1301 | while ((t = ign->tunnels[prio][h]) != NULL) | 1301 | |
1302 | unregister_netdevice(t->dev); | 1302 | while (t != NULL) { |
1303 | unregister_netdevice_queue(t->dev, head); | ||
1304 | t = t->next; | ||
1305 | } | ||
1303 | } | 1306 | } |
1304 | } | 1307 | } |
1305 | } | 1308 | } |
@@ -1347,10 +1350,12 @@ err_alloc: | |||
1347 | static void ipgre_exit_net(struct net *net) | 1350 | static void ipgre_exit_net(struct net *net) |
1348 | { | 1351 | { |
1349 | struct ipgre_net *ign; | 1352 | struct ipgre_net *ign; |
1353 | LIST_HEAD(list); | ||
1350 | 1354 | ||
1351 | ign = net_generic(net, ipgre_net_id); | 1355 | ign = net_generic(net, ipgre_net_id); |
1352 | rtnl_lock(); | 1356 | rtnl_lock(); |
1353 | ipgre_destroy_tunnels(ign); | 1357 | ipgre_destroy_tunnels(ign, &list); |
1358 | unregister_netdevice_many(&list); | ||
1354 | rtnl_unlock(); | 1359 | rtnl_unlock(); |
1355 | kfree(ign); | 1360 | kfree(ign); |
1356 | } | 1361 | } |