diff mbox series

[net-next] net: ethtool: phy: Don't set the context dev pointer for unfiltered DUMP

Message ID 20240913100515.167341-1-maxime.chevallier@bootlin.com (mailing list archive)
State Accepted
Commit 1ad84a151af7f4b3933983677bc75074f957bdf5
Delegated to: Netdev Maintainers
Headers show
Series [net-next] net: ethtool: phy: Don't set the context dev pointer for unfiltered DUMP | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 16 this patch: 16
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 6 of 6 maintainers
netdev/build_clang success Errors and warnings before: 16 this patch: 16
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 16 this patch: 16
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-09-13--15-00 (tests: 764)

Commit Message

Maxime Chevallier Sept. 13, 2024, 10:05 a.m. UTC
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(-)

Comments

Vadim Fedorenko Sept. 13, 2024, 4:40 p.m. UTC | #1
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>
patchwork-bot+netdevbpf@kernel.org Sept. 14, 2024, 4:50 a.m. UTC | #2
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!
diff mbox series

Patch

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;