netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: ethtool: phy: Don't set the context dev pointer for unfiltered DUMP
@ 2024-09-13 10:05 Maxime Chevallier
  2024-09-13 16:40 ` Vadim Fedorenko
  2024-09-14  4:50 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Maxime Chevallier @ 2024-09-13 10:05 UTC (permalink / raw)
  To: davem
  Cc: Maxime Chevallier, netdev, linux-kernel, thomas.petazzoni,
	Andrew Lunn, Jakub Kicinski, Eric Dumazet, Paolo Abeni,
	Russell King, linux-arm-kernel, Christophe Leroy, Herve Codina,
	Florian Fainelli, Heiner Kallweit, Vladimir Oltean,
	Köry Maincent, Marek Behún, Piergiorgio Beruto,
	Oleksij Rempel, Nicolò Veronese, Simon Horman, mwojtas,
	Nathan Chancellor, Antoine Tenart, Marc Kleine-Budde,
	Dan Carpenter, Romain Gantois, syzbot+e9ed4e4368d450c8f9db

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: syzbot+e9ed4e4368d450c8f9db@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/netdev/000000000000d3bf150621d361a7@google.com/
Fixes: 17194be4c8e1 ("net: ethtool: Introduce a command to list PHYs on an interface")
Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
---
This patch fixes a commit that still lives in net-next.

 net/ethtool/phy.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/net/ethtool/phy.c b/net/ethtool/phy.c
index 4ef7c6e32d10..ed8f690f6bac 100644
--- a/net/ethtool/phy.c
+++ b/net/ethtool/phy.c
@@ -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;
 
-- 
2.46.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] net: ethtool: phy: Don't set the context dev pointer for unfiltered DUMP
  2024-09-13 10:05 [PATCH net-next] net: ethtool: phy: Don't set the context dev pointer for unfiltered DUMP Maxime Chevallier
@ 2024-09-13 16:40 ` Vadim Fedorenko
  2024-09-14  4:50 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Vadim Fedorenko @ 2024-09-13 16:40 UTC (permalink / raw)
  To: Maxime Chevallier, Jakub Kicinski
  Cc: netdev, linux-kernel, thomas.petazzoni, Andrew Lunn,
	Jakub Kicinski, Eric Dumazet, Paolo Abeni, Russell King,
	linux-arm-kernel, Christophe Leroy, Herve Codina,
	Florian Fainelli, Heiner Kallweit, Vladimir Oltean,
	Köry Maincent, Marek Behún, Piergiorgio Beruto,
	Oleksij Rempel, Nicolò Veronese, Simon Horman, mwojtas,
	Nathan Chancellor, Antoine Tenart, Marc Kleine-Budde,
	Dan Carpenter, Romain Gantois, syzbot+e9ed4e4368d450c8f9db, davem

On 13/09/2024 11:05, Maxime Chevallier 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().
> 
> Reported-by: syzbot+e9ed4e4368d450c8f9db@syzkaller.appspotmail.com
> Closes: https://lore.kernel.org/netdev/000000000000d3bf150621d361a7@google.com/
> Fixes: 17194be4c8e1 ("net: ethtool: Introduce a command to list PHYs on an interface")
> Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
> ---
> This patch fixes a commit that still lives in net-next.
> 
>   net/ethtool/phy.c | 2 --
>   1 file changed, 2 deletions(-)
> 
> diff --git a/net/ethtool/phy.c b/net/ethtool/phy.c
> index 4ef7c6e32d10..ed8f690f6bac 100644
> --- a/net/ethtool/phy.c
> +++ b/net/ethtool/phy.c
> @@ -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.

Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] net: ethtool: phy: Don't set the context dev pointer for unfiltered DUMP
  2024-09-13 10:05 [PATCH net-next] net: ethtool: phy: Don't set the context dev pointer for unfiltered DUMP Maxime Chevallier
  2024-09-13 16:40 ` Vadim Fedorenko
@ 2024-09-14  4:50 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-09-14  4:50 UTC (permalink / raw)
  To: Maxime Chevallier
  Cc: davem, netdev, linux-kernel, thomas.petazzoni, andrew, kuba,
	edumazet, pabeni, linux, linux-arm-kernel, christophe.leroy,
	herve.codina, f.fainelli, hkallweit1, vladimir.oltean,
	kory.maincent, kabel, piergiorgio.beruto, o.rempel, nicveronese,
	horms, mwojtas, nathan, atenart, mkl, dan.carpenter,
	romain.gantois, syzbot+e9ed4e4368d450c8f9db

Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

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!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-09-14  4:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-13 10:05 [PATCH net-next] net: ethtool: phy: Don't set the context dev pointer for unfiltered DUMP Maxime Chevallier
2024-09-13 16:40 ` Vadim Fedorenko
2024-09-14  4:50 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).