Commit b2dcdc7f authored by Eric Dumazet's avatar Eric Dumazet Committed by Jakub Kicinski

net: bridge: add net device refcount tracker

Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 19c9ebf6
......@@ -274,7 +274,7 @@ static void destroy_nbp(struct net_bridge_port *p)
p->br = NULL;
p->dev = NULL;
dev_put(dev);
dev_put_track(dev, &p->dev_tracker);
kobject_put(&p->kobj);
}
......@@ -423,7 +423,7 @@ static struct net_bridge_port *new_nbp(struct net_bridge *br,
return ERR_PTR(-ENOMEM);
p->br = br;
dev_hold(dev);
dev_hold_track(dev, &p->dev_tracker, GFP_KERNEL);
p->dev = dev;
p->path_cost = port_cost(dev);
p->priority = 0x8000 >> BR_PORT_BITS;
......@@ -434,7 +434,7 @@ static struct net_bridge_port *new_nbp(struct net_bridge *br,
br_stp_port_timer_init(p);
err = br_multicast_add_port(p);
if (err) {
dev_put(dev);
dev_put_track(dev, &p->dev_tracker);
kfree(p);
p = ERR_PTR(err);
}
......
......@@ -344,6 +344,7 @@ struct net_bridge_mdb_entry {
struct net_bridge_port {
struct net_bridge *br;
struct net_device *dev;
netdevice_tracker dev_tracker;
struct list_head list;
unsigned long flags;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment