aboutsummaryrefslogtreecommitdiffstats
path: root/net/core
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2015-04-02 16:16:53 -0400
committerDavid S. Miller <davem@davemloft.net>2015-04-02 16:16:53 -0400
commit9f0d34bc344889c2e6c593bd949d7ab821f0f4a5 (patch)
treee5bfc776a09315afa4dbcae97ac04f2cca239c96 /net/core
parente4a924f5768c55002c02ceba9b9f86824c35f956 (diff)
parent0a4812798fae4f6bfcaab51e31b3898ff5ea3108 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Conflicts: drivers/net/usb/asix_common.c drivers/net/usb/sr9800.c drivers/net/usb/usbnet.c include/linux/usb/usbnet.h net/ipv4/tcp_ipv4.c net/ipv6/tcp_ipv6.c The TCP conflicts were overlapping changes. In 'net' we added a READ_ONCE() to the socket cached RX route read, whilst in 'net-next' Eric Dumazet touched the surrounding code dealing with how mini sockets are handled. With USB, it's a case of the same bug fix first going into net-next and then I cherry picked it back into net. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r--net/core/net_namespace.c24
-rw-r--r--net/core/rtnetlink.c4
2 files changed, 17 insertions, 11 deletions
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
index e5e96b0f6717..ce6396a75b8b 100644
--- a/net/core/net_namespace.c
+++ b/net/core/net_namespace.c
@@ -338,7 +338,7 @@ static LIST_HEAD(cleanup_list); /* Must hold cleanup_list_lock to touch */
338static void cleanup_net(struct work_struct *work) 338static void cleanup_net(struct work_struct *work)
339{ 339{
340 const struct pernet_operations *ops; 340 const struct pernet_operations *ops;
341 struct net *net, *tmp; 341 struct net *net, *tmp, *peer;
342 struct list_head net_kill_list; 342 struct list_head net_kill_list;
343 LIST_HEAD(net_exit_list); 343 LIST_HEAD(net_exit_list);
344 344
@@ -354,14 +354,6 @@ static void cleanup_net(struct work_struct *work)
354 list_for_each_entry(net, &net_kill_list, cleanup_list) { 354 list_for_each_entry(net, &net_kill_list, cleanup_list) {
355 list_del_rcu(&net->list); 355 list_del_rcu(&net->list);
356 list_add_tail(&net->exit_list, &net_exit_list); 356 list_add_tail(&net->exit_list, &net_exit_list);
357 for_each_net(tmp) {
358 int id = __peernet2id(tmp, net, false);
359
360 if (id >= 0)
361 idr_remove(&tmp->netns_ids, id);
362 }
363 idr_destroy(&net->netns_ids);
364
365 } 357 }
366 rtnl_unlock(); 358 rtnl_unlock();
367 359
@@ -387,12 +379,26 @@ static void cleanup_net(struct work_struct *work)
387 */ 379 */
388 rcu_barrier(); 380 rcu_barrier();
389 381
382 rtnl_lock();
390 /* Finally it is safe to free my network namespace structure */ 383 /* Finally it is safe to free my network namespace structure */
391 list_for_each_entry_safe(net, tmp, &net_exit_list, exit_list) { 384 list_for_each_entry_safe(net, tmp, &net_exit_list, exit_list) {
385 /* Unreference net from all peers (no need to loop over
386 * net_exit_list because idr_destroy() will be called for each
387 * element of this list.
388 */
389 for_each_net(peer) {
390 int id = __peernet2id(peer, net, false);
391
392 if (id >= 0)
393 idr_remove(&peer->netns_ids, id);
394 }
395 idr_destroy(&net->netns_ids);
396
392 list_del_init(&net->exit_list); 397 list_del_init(&net->exit_list);
393 put_user_ns(net->user_ns); 398 put_user_ns(net->user_ns);
394 net_drop_ns(net); 399 net_drop_ns(net);
395 } 400 }
401 rtnl_unlock();
396} 402}
397static DECLARE_WORK(net_cleanup_work, cleanup_net); 403static DECLARE_WORK(net_cleanup_work, cleanup_net);
398 404
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index ee0186cdd5cf..5e02260b087f 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -1991,10 +1991,10 @@ static int rtnl_group_changelink(const struct sk_buff *skb,
1991 struct ifinfomsg *ifm, 1991 struct ifinfomsg *ifm,
1992 struct nlattr **tb) 1992 struct nlattr **tb)
1993{ 1993{
1994 struct net_device *dev; 1994 struct net_device *dev, *aux;
1995 int err; 1995 int err;
1996 1996
1997 for_each_netdev(net, dev) { 1997 for_each_netdev_safe(net, dev, aux) {
1998 if (dev->group == group) { 1998 if (dev->group == group) {
1999 err = do_setlink(skb, dev, ifm, tb, NULL, 0); 1999 err = do_setlink(skb, dev, ifm, tb, NULL, 0);
2000 if (err < 0) 2000 if (err < 0)