mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 10:00:17 +00:00
net: ethtool: netlink: Use netdev_hold for dumpit() operations
Move away from dev_hold and use netdev_hold with a local reftracker when performing a DUMP on each netdev. Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com> Link: https://patch.msgid.link/20250502085242.248645-4-maxime.chevallier@bootlin.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
committed by
Jakub Kicinski
parent
9dd2ad5e92
commit
63fb100bf5
@@ -603,18 +603,19 @@ static int ethnl_default_dumpit(struct sk_buff *skb,
|
||||
{
|
||||
struct ethnl_dump_ctx *ctx = ethnl_dump_context(cb);
|
||||
struct net *net = sock_net(skb->sk);
|
||||
netdevice_tracker dev_tracker;
|
||||
struct net_device *dev;
|
||||
int ret = 0;
|
||||
|
||||
rcu_read_lock();
|
||||
for_each_netdev_dump(net, dev, ctx->pos_ifindex) {
|
||||
dev_hold(dev);
|
||||
netdev_hold(dev, &dev_tracker, GFP_ATOMIC);
|
||||
rcu_read_unlock();
|
||||
|
||||
ret = ethnl_default_dump_one(skb, dev, ctx, genl_info_dump(cb));
|
||||
|
||||
rcu_read_lock();
|
||||
dev_put(dev);
|
||||
netdev_put(dev, &dev_tracker);
|
||||
|
||||
if (ret < 0 && ret != -EOPNOTSUPP) {
|
||||
if (likely(skb->len))
|
||||
|
||||
Reference in New Issue
Block a user