bridge: call br_netpoll_disable in br_add_if
authorGao feng <gaofeng@cn.fujitsu.com>
Wed, 19 Dec 2012 23:41:43 +0000 (23:41 +0000)
committerDavid S. Miller <davem@davemloft.net>
Fri, 21 Dec 2012 21:17:07 +0000 (13:17 -0800)
When netdev_set_master faild in br_add_if, we should
call br_netpoll_disable to do some cleanup jobs,such
as free the memory of struct netpoll which allocated
in br_netpoll_enable.

Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
Acked-by: Cong Wang <amwang@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/bridge/br_if.c

index 1c8fdc3558cd48e9ad5d7be9c3981ebf80878364..37fe693471a84d6815b31a5efcadfd836c0be254 100644 (file)
@@ -366,11 +366,11 @@ int br_add_if(struct net_bridge *br, struct net_device *dev)
 
        err = netdev_set_master(dev, br->dev);
        if (err)
-               goto err3;
+               goto err4;
 
        err = netdev_rx_handler_register(dev, br_handle_frame, p);
        if (err)
-               goto err4;
+               goto err5;
 
        dev->priv_flags |= IFF_BRIDGE_PORT;
 
@@ -402,8 +402,10 @@ int br_add_if(struct net_bridge *br, struct net_device *dev)
 
        return 0;
 
-err4:
+err5:
        netdev_set_master(dev, NULL);
+err4:
+       br_netpoll_disable(p);
 err3:
        sysfs_remove_link(br->ifobj, p->dev->name);
 err2: