public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH net-next] net: ethtool: phy: Check the req_info.pdn field for GET commands
@ 2024-09-10 17:46 Maxime Chevallier
  2024-09-11  7:26 ` Eric Dumazet
  2024-09-12  0:10 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 6+ messages in thread
From: Maxime Chevallier @ 2024-09-10 17:46 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, Jesse Brandeburg, Marek Behún,
	Piergiorgio Beruto, Oleksij Rempel, Nicolò Veronese,
	Simon Horman, mwojtas, Nathan Chancellor, Antoine Tenart,
	Marc Kleine-Budde, Dan Carpenter, Romain Gantois

When processing the netlink GET requests to get PHY info, the req_info.pdn
pointer is NULL when no PHY matches the requested parameters, such as when
the phy_index is invalid, or there's simply no PHY attached to the
interface.

Therefore, check the req_info.pdn pointer for NULL instead of
dereferencing it.

Suggested-by: Eric Dumazet <edumazet@google.com>
Reported-by: Eric Dumazet <edumazet@google.com>
Closes: https://lore.kernel.org/netdev/CANn89iKRW0WpGAh1tKqY345D8WkYCPm3Y9ym--Si42JZrQAu1g@mail.gmail.com/T/#mfced87d607d18ea32b3b4934dfa18d7b36669285
Fixes: 17194be4c8e1 ("net: ethtool: Introduce a command to list PHYs on an interface")
Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
---
Hi,

I'm targetting net-next as the commit this patch fixes is still in
net-next.

 net/ethtool/phy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ethtool/phy.c b/net/ethtool/phy.c
index 560dd039c662..4ef7c6e32d10 100644
--- a/net/ethtool/phy.c
+++ b/net/ethtool/phy.c
@@ -164,7 +164,7 @@ int ethnl_phy_doit(struct sk_buff *skb, struct genl_info *info)
 		goto err_unlock_rtnl;
 
 	/* No PHY, return early */
-	if (!req_info.pdn->phy)
+	if (!req_info.pdn)
 		goto err_unlock_rtnl;
 
 	ret = ethnl_phy_reply_size(&req_info.base, info->extack);
-- 
2.46.0



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

* Re: [PATCH net-next] net: ethtool: phy: Check the req_info.pdn field for GET commands
  2024-09-10 17:46 [PATCH net-next] net: ethtool: phy: Check the req_info.pdn field for GET commands Maxime Chevallier
@ 2024-09-11  7:26 ` Eric Dumazet
  2024-09-11  8:33   ` Maxime Chevallier
  2024-09-12  0:10 ` patchwork-bot+netdevbpf
  1 sibling, 1 reply; 6+ messages in thread
From: Eric Dumazet @ 2024-09-11  7:26 UTC (permalink / raw)
  To: Maxime Chevallier
  Cc: davem, netdev, linux-kernel, thomas.petazzoni, Andrew Lunn,
	Jakub Kicinski, Paolo Abeni, Russell King, linux-arm-kernel,
	Christophe Leroy, Herve Codina, Florian Fainelli, Heiner Kallweit,
	Vladimir Oltean, Köry Maincent, Jesse Brandeburg,
	Marek Behún, Piergiorgio Beruto, Oleksij Rempel,
	Nicolò Veronese, Simon Horman, mwojtas, Nathan Chancellor,
	Antoine Tenart, Marc Kleine-Budde, Dan Carpenter, Romain Gantois

On Tue, Sep 10, 2024 at 7:46 PM Maxime Chevallier
<maxime.chevallier@bootlin.com> wrote:
>
> When processing the netlink GET requests to get PHY info, the req_info.pdn
> pointer is NULL when no PHY matches the requested parameters, such as when
> the phy_index is invalid, or there's simply no PHY attached to the
> interface.
>
> Therefore, check the req_info.pdn pointer for NULL instead of
> dereferencing it.
>
> Suggested-by: Eric Dumazet <edumazet@google.com>
> Reported-by: Eric Dumazet <edumazet@google.com>
> Closes: https://lore.kernel.org/netdev/CANn89iKRW0WpGAh1tKqY345D8WkYCPm3Y9ym--Si42JZrQAu1g@mail.gmail.com/T/#mfced87d607d18ea32b3b4934dfa18d7b36669285
> Fixes: 17194be4c8e1 ("net: ethtool: Introduce a command to list PHYs on an interface")
> Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
> ---

Thanks, there is another issue found by syzbot BTW (one imbalanced netdev_put())

Reviewed-by: Eric Dumazet <edumazet@google.com>


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

* Re: [PATCH net-next] net: ethtool: phy: Check the req_info.pdn field for GET commands
  2024-09-11  7:26 ` Eric Dumazet
@ 2024-09-11  8:33   ` Maxime Chevallier
  2024-09-11  8:37     ` Maxime Chevallier
  0 siblings, 1 reply; 6+ messages in thread
From: Maxime Chevallier @ 2024-09-11  8:33 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: davem, netdev, linux-kernel, thomas.petazzoni, Andrew Lunn,
	Jakub Kicinski, Paolo Abeni, Russell King, linux-arm-kernel,
	Christophe Leroy, Herve Codina, Florian Fainelli, Heiner Kallweit,
	Vladimir Oltean, Köry Maincent, Jesse Brandeburg,
	Marek Behún, Piergiorgio Beruto, Oleksij Rempel,
	Nicolò Veronese, Simon Horman, mwojtas, Nathan Chancellor,
	Antoine Tenart, Marc Kleine-Budde, Dan Carpenter, Romain Gantois

Hi Eric,

On Wed, 11 Sep 2024 09:26:23 +0200
Eric Dumazet <edumazet@google.com> wrote:

> On Tue, Sep 10, 2024 at 7:46 PM Maxime Chevallier
> <maxime.chevallier@bootlin.com> wrote:
> >
> > When processing the netlink GET requests to get PHY info, the req_info.pdn
> > pointer is NULL when no PHY matches the requested parameters, such as when
> > the phy_index is invalid, or there's simply no PHY attached to the
> > interface.
> >
> > Therefore, check the req_info.pdn pointer for NULL instead of
> > dereferencing it.
> >
> > Suggested-by: Eric Dumazet <edumazet@google.com>
> > Reported-by: Eric Dumazet <edumazet@google.com>
> > Closes: https://lore.kernel.org/netdev/CANn89iKRW0WpGAh1tKqY345D8WkYCPm3Y9ym--Si42JZrQAu1g@mail.gmail.com/T/#mfced87d607d18ea32b3b4934dfa18d7b36669285
> > Fixes: 17194be4c8e1 ("net: ethtool: Introduce a command to list PHYs on an interface")
> > Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
> > ---  
> 
> Thanks, there is another issue found by syzbot BTW (one imbalanced netdev_put())

Sorry for asking that, but I missed the report from this current patch,
as well as the one you're referring to. I've looked-up the netdev
archive and the syzbot web interface [1] and found no reports for both
issues. I am clearly not looking at the right place, and/or I probably
need to open my eyes a bit more.

Can you point me to the report in question ?

[1] : https://syzkaller.appspot.com/upstream/s/net

> 
> Reviewed-by: Eric Dumazet <edumazet@google.com>

Thanks for the review,

Maxime



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

* Re: [PATCH net-next] net: ethtool: phy: Check the req_info.pdn field for GET commands
  2024-09-11  8:33   ` Maxime Chevallier
@ 2024-09-11  8:37     ` Maxime Chevallier
  2024-09-11  9:20       ` Eric Dumazet
  0 siblings, 1 reply; 6+ messages in thread
From: Maxime Chevallier @ 2024-09-11  8:37 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: davem, netdev, linux-kernel, thomas.petazzoni, Andrew Lunn,
	Jakub Kicinski, Paolo Abeni, Russell King, linux-arm-kernel,
	Christophe Leroy, Herve Codina, Florian Fainelli, Heiner Kallweit,
	Vladimir Oltean, Köry Maincent, Jesse Brandeburg,
	Marek Behún, Piergiorgio Beruto, Oleksij Rempel,
	Nicolò Veronese, Simon Horman, mwojtas, Nathan Chancellor,
	Antoine Tenart, Marc Kleine-Budde, Dan Carpenter, Romain Gantois

Hi,

On Wed, 11 Sep 2024 10:33:22 +0200
Maxime Chevallier <maxime.chevallier@bootlin.com> wrote:


> Sorry for asking that, but I missed the report from this current patch,
> as well as the one you're referring to. I've looked-up the netdev
> archive and the syzbot web interface [1] and found no reports for both
> issues. I am clearly not looking at the right place, and/or I probably
> need to open my eyes a bit more.

Heh my bad, I just received the report in question. Looks like you are
getting these before I do :)

Thanks,

Maxime



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

* Re: [PATCH net-next] net: ethtool: phy: Check the req_info.pdn field for GET commands
  2024-09-11  8:37     ` Maxime Chevallier
@ 2024-09-11  9:20       ` Eric Dumazet
  0 siblings, 0 replies; 6+ messages in thread
From: Eric Dumazet @ 2024-09-11  9:20 UTC (permalink / raw)
  To: Maxime Chevallier
  Cc: davem, netdev, linux-kernel, thomas.petazzoni, Andrew Lunn,
	Jakub Kicinski, Paolo Abeni, Russell King, linux-arm-kernel,
	Christophe Leroy, Herve Codina, Florian Fainelli, Heiner Kallweit,
	Vladimir Oltean, Köry Maincent, Jesse Brandeburg,
	Marek Behún, Piergiorgio Beruto, Oleksij Rempel,
	Nicolò Veronese, Simon Horman, mwojtas, Nathan Chancellor,
	Antoine Tenart, Marc Kleine-Budde, Dan Carpenter, Romain Gantois

On Wed, Sep 11, 2024 at 10:37 AM Maxime Chevallier
<maxime.chevallier@bootlin.com> wrote:
>
> Hi,
>
> On Wed, 11 Sep 2024 10:33:22 +0200
> Maxime Chevallier <maxime.chevallier@bootlin.com> wrote:
>
>
> > Sorry for asking that, but I missed the report from this current patch,
> > as well as the one you're referring to. I've looked-up the netdev
> > archive and the syzbot web interface [1] and found no reports for both
> > issues. I am clearly not looking at the right place, and/or I probably
> > need to open my eyes a bit more.
>
> Heh my bad, I just received the report in question. Looks like you are
> getting these before I do :)

I triage the reports, to avoid flooding mailing list with duplicates,
and possibly catch very serious security bugs.

I usually wait for some consistent signal like a repro, so that a
single email is sent to the list.


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

* Re: [PATCH net-next] net: ethtool: phy: Check the req_info.pdn field for GET commands
  2024-09-10 17:46 [PATCH net-next] net: ethtool: phy: Check the req_info.pdn field for GET commands Maxime Chevallier
  2024-09-11  7:26 ` Eric Dumazet
@ 2024-09-12  0:10 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-09-12  0:10 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, jesse.brandeburg, kabel, piergiorgio.beruto,
	o.rempel, nicveronese, horms, mwojtas, nathan, atenart, mkl,
	dan.carpenter, romain.gantois

Hello:

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

On Tue, 10 Sep 2024 19:46:35 +0200 you wrote:
> When processing the netlink GET requests to get PHY info, the req_info.pdn
> pointer is NULL when no PHY matches the requested parameters, such as when
> the phy_index is invalid, or there's simply no PHY attached to the
> interface.
> 
> Therefore, check the req_info.pdn pointer for NULL instead of
> dereferencing it.
> 
> [...]

Here is the summary with links:
  - [net-next] net: ethtool: phy: Check the req_info.pdn field for GET commands
    https://git.kernel.org/netdev/net-next/c/fce1e9f86af1

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] 6+ messages in thread

end of thread, other threads:[~2024-09-12  0:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-10 17:46 [PATCH net-next] net: ethtool: phy: Check the req_info.pdn field for GET commands Maxime Chevallier
2024-09-11  7:26 ` Eric Dumazet
2024-09-11  8:33   ` Maxime Chevallier
2024-09-11  8:37     ` Maxime Chevallier
2024-09-11  9:20       ` Eric Dumazet
2024-09-12  0:10 ` 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