Skip to contentSkip to conversation

net: ethtool: phy: Don't set the context dev pointer for unfiltered DUMP

PATCH Applied Maxime Chevallier 3 participants 3 messages Sep 13, 2024 – Sep 14, 2024

Subsystems (4)
lore
Share & tools
lore

Maxime Chevallier

author maintainer
#0 lore raw

PATCH 1/1 net: ethtool: phy: Don't set the context dev pointer for unfiltered DUMP

The context info allows continuing DUMP requests, shall they fill the netlink buffer.

In the case of filtered DUMP requests, a reference on the netdev is grabbed in the .start() callback and release in .done().

Unfiltered DUMP request don't need the dev pointer to be set in the context info, doing so will trigger an unwanted netdev_put() in .done().

Reported-by [email protected]
Fixes 17194be4c8e1 ("net: ethtool: Introduce a command to list PHYs on an interface")

---
This patch fixes a commit that still lives in net-next.

 net/ethtool/phy.c | 2 --
 1 file changed, 2 deletions(-)
net/ethtool/phy.c +0 -2
index 4ef7c6e32d10..ed8f690f6bac 100644
@@ -251,8 +251,6 @@ static int ethnl_phy_dump_one_dev(struct sk_buff *skb, struct net_device *dev,
 	int ret = 0;
 	void *ehdr;
 
-	pri->base.dev = dev;
-
 	if (!dev->link_topo)
 		return 0;
 
Signature · 1 line
2.46.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 24 lines · Maxime Chevallier

The context info allows continuing DUMP requests, shall they fill the netlink buffer.

In the case of filtered DUMP requests, a reference on the netdev is grabbed in the .start() callback and release in .done().

Unfiltered DUMP request don't need the dev pointer to be set in the context info, doing so will trigger an unwanted netdev_put() in .done().

Reported-by [email protected]
Fixes 17194be4c8e1 ("net: ethtool: Introduce a command to list PHYs on an interface")

---
This patch fixes a commit that still lives in net-next.

  net/ethtool/phy.c | 2 --
  1 file changed, 2 deletions(-)
net/ethtool/phy.c +0 -0
index 4ef7c6e32d10..ed8f690f6bac 100644

net/ethtool/phy.c static int ethnl_phy_dump_one_dev(struct sk_buff *skb, struct net_device *dev, · line 256

Quoted 8 lines
net/ethtool/phy.c +0 -2
@@ -251,8 +251,6 @@ static int ethnl_phy_dump_one_dev(struct sk_buff *skb, struct net_device *dev,
  	int ret = 0;
  	void *ehdr;
 
-	pri->base.dev = dev;
-
  	if (!dev->link_topo)
  		return 0;
 

I've checked that this is leftover from the previous series.

#2 lore raw
In reply to Maxime Chevallier
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 10 lines · On Fri, 13 Sep 2024 12:05:14 +0200 you wrote:

The context info allows continuing DUMP requests, shall they fill the netlink buffer.

In the case of filtered DUMP requests, a reference on the netdev is grabbed in the .start() callback and release in .done().

Unfiltered DUMP request don't need the dev pointer to be set in the context info, doing so will trigger an unwanted netdev_put() in .done().

[...]

Here is the summary with links:
- [net-next] net: ethtool: phy: Don't set the context dev pointer for unfiltered DUMP

    https://git.kernel.org/netdev/net-next/c/1ad84a151af7

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html