diff options
author | Eric Dumazet <edumazet@google.com> | 2021-12-07 02:30:29 +0100 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2021-12-08 05:44:58 +0100 |
commit | b2dcdc7f731dfd8957ee2ca8be6c5d83bd0d95e3 (patch) | |
tree | 6181365e97637e8cfabc6137d3754cfc41f5d7e4 /net/bridge | |
parent | vlan: add net device refcount tracker (diff) | |
download | linux-b2dcdc7f731dfd8957ee2ca8be6c5d83bd0d95e3.tar.xz linux-b2dcdc7f731dfd8957ee2ca8be6c5d83bd0d95e3.zip |
net: bridge: add net device refcount tracker
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/bridge')
-rw-r--r-- | net/bridge/br_if.c | 6 | ||||
-rw-r--r-- | net/bridge/br_private.h | 1 |
2 files changed, 4 insertions, 3 deletions
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c index 3915832a03c2..a52ad81596b7 100644 --- a/net/bridge/br_if.c +++ b/net/bridge/br_if.c @@ -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); } diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h index c0efd697865a..af2b3512d86c 100644 --- a/net/bridge/br_private.h +++ b/net/bridge/br_private.h @@ -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; |