summaryrefslogtreecommitdiffstats
path: root/drivers/net/macvlan.c
diff options
context:
space:
mode:
authorZiyang Xuan <william.xuanziyang@huawei.com>2022-03-11 10:04:03 +0100
committerDavid S. Miller <davem@davemloft.net>2022-03-14 11:06:54 +0100
commit1f4a5983d623d6dbda4cc7587a2d9d798e0d4035 (patch)
tree016666de92847148d489058102bdd5023d62869b /drivers/net/macvlan.c
parentnet: macvlan: fix potential UAF problem for lowerdev (diff)
downloadlinux-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.c4
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)