bridge br_multicast: BUG: unable to handle kernel NULL pointer dereference
[linux-drm-fsl-dcu.git] / net / bridge / br_if.c
index 0b6b1f2ff7acb4000892dd08e1e9834844d188e7..18b245e2c00edb642ef59c1aa2f5e03324a38790 100644 (file)
@@ -13,6 +13,7 @@
 
 #include <linux/kernel.h>
 #include <linux/netdevice.h>
+#include <linux/netpoll.h>
 #include <linux/ethtool.h>
 #include <linux/if_arp.h>
 #include <linux/module.h>
@@ -132,7 +133,7 @@ static void del_nbp(struct net_bridge_port *p)
        struct net_bridge *br = p->br;
        struct net_device *dev = p->dev;
 
-       sysfs_remove_link(br->ifobj, dev->name);
+       sysfs_remove_link(br->ifobj, p->dev->name);
 
        dev_set_promiscuity(dev, -1);
 
@@ -153,6 +154,7 @@ static void del_nbp(struct net_bridge_port *p)
        kobject_uevent(&p->kobj, KOBJ_REMOVE);
        kobject_del(&p->kobj);
 
+       br_netpoll_disable(br, dev);
        call_rcu(&p->rcu, destroy_nbp_rcu);
 }
 
@@ -165,6 +167,8 @@ static void del_br(struct net_bridge *br, struct list_head *head)
                del_nbp(p);
        }
 
+       br_netpoll_cleanup(br->dev);
+
        del_timer_sync(&br->gc_timer);
 
        br_sysfs_delbr(br->dev);
@@ -186,6 +190,12 @@ static struct net_device *new_bridge_dev(struct net *net, const char *name)
        br = netdev_priv(dev);
        br->dev = dev;
 
+       br->stats = alloc_percpu(struct br_cpu_netstats);
+       if (!br->stats) {
+               free_netdev(dev);
+               return NULL;
+       }
+
        spin_lock_init(&br->lock);
        INIT_LIST_HEAD(&br->port_list);
        spin_lock_init(&br->hash_lock);
@@ -438,6 +448,8 @@ int br_add_if(struct net_bridge *br, struct net_device *dev)
 
        kobject_uevent(&p->kobj, KOBJ_ADD);
 
+       br_netpoll_enable(br, dev);
+
        return 0;
 err2:
        br_fdb_delete_by_port(br, p, 1);