bonding: fix device leak on error in bond_create()
[linux-2.6.git] / drivers / net / bonding / bond_ipv6.c
index 11581da..6dd64cf 100644 (file)
  *
  */
 
-//#define BONDING_DEBUG 1
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
 #include <linux/types.h>
 #include <linux/if_vlan.h>
 #include <net/ipv6.h>
 #include <net/ndisc.h>
 #include <net/addrconf.h>
+#include <net/netns/generic.h>
 #include "bonding.h"
 
 /*
@@ -74,21 +75,21 @@ static void bond_na_send(struct net_device *slave_dev,
 
        addrconf_addr_solict_mult(daddr, &mcaddr);
 
-       dprintk("ipv6 na on slave %s: dest %pI6, src %pI6\n",
-              slave_dev->name, &mcaddr, daddr);
+       pr_debug("ipv6 na on slave %s: dest %pI6, src %pI6\n",
+                slave_dev->name, &mcaddr, daddr);
 
        skb = ndisc_build_skb(slave_dev, &mcaddr, daddr, &icmp6h, daddr,
                              ND_OPT_TARGET_LL_ADDR);
 
        if (!skb) {
-               printk(KERN_ERR DRV_NAME ": NA packet allocation failed\n");
+               pr_err("NA packet allocation failed\n");
                return;
        }
 
        if (vlan_id) {
                skb = vlan_put_tag(skb, vlan_id);
                if (!skb) {
-                       printk(KERN_ERR DRV_NAME ": failed to insert VLAN tag\n");
+                       pr_err("failed to insert VLAN tag\n");
                        return;
                }
        }
@@ -110,8 +111,8 @@ void bond_send_unsolicited_na(struct bonding *bond)
        struct inet6_dev *idev;
        int is_router;
 
-       dprintk("bond_send_unsol_na: bond %s slave %s\n", bond->dev->name,
-                               slave ? slave->dev->name : "NULL");
+       pr_debug("%s: bond %s slave %s\n", bond->dev->name,
+                __func__, slave ? slave->dev->name : "NULL");
 
        if (!slave || !bond->send_unsol_na ||
            test_bit(__LINK_STATE_LINKWATCH_PENDING, &slave->dev->state))
@@ -154,11 +155,9 @@ static int bond_inet6addr_event(struct notifier_block *this,
        struct net_device *vlan_dev, *event_dev = ifa->idev->dev;
        struct bonding *bond;
        struct vlan_entry *vlan;
+       struct bond_net *bn = net_generic(dev_net(event_dev), bond_net_id);
 
-       if (dev_net(event_dev) != &init_net)
-               return NOTIFY_DONE;
-
-       list_for_each_entry(bond, &bond_dev_list, bond_list) {
+       list_for_each_entry(bond, &bn->dev_list, bond_list) {
                if (bond->dev == event_dev) {
                        switch (event) {
                        case NETDEV_UP: