diff options
author | Ziyang Xuan <william.xuanziyang@huawei.com> | 2022-03-11 10:04:03 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2022-03-14 11:06:54 +0100 |
commit | 1f4a5983d623d6dbda4cc7587a2d9d798e0d4035 (patch) | |
tree | 016666de92847148d489058102bdd5023d62869b /drivers/net/macvlan.c | |
parent | net: macvlan: fix potential UAF problem for lowerdev (diff) | |
download | linux-1f4a5983d623d6dbda4cc7587a2d9d798e0d4035.tar.xz linux-1f4a5983d623d6dbda4cc7587a2d9d798e0d4035.zip |
net: macvlan: add net device refcount tracker
Add net device refcount tracker to macvlan.
Signed-off-by: Ziyang Xuan <william.xuanziyang@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/macvlan.c')
-rw-r--r-- | drivers/net/macvlan.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c index b339581e36aa..069e8824c264 100644 --- a/drivers/net/macvlan.c +++ b/drivers/net/macvlan.c @@ -912,7 +912,7 @@ static int macvlan_init(struct net_device *dev) port->count += 1; /* Get macvlan's reference to lowerdev */ - dev_hold(lowerdev); + dev_hold_track(lowerdev, &vlan->dev_tracker, GFP_KERNEL); return 0; } @@ -1181,7 +1181,7 @@ static void macvlan_dev_free(struct net_device *dev) struct macvlan_dev *vlan = netdev_priv(dev); /* Get rid of the macvlan's reference to lowerdev */ - dev_put(vlan->lowerdev); + dev_put_track(vlan->lowerdev, &vlan->dev_tracker); } void macvlan_common_setup(struct net_device *dev) |