lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAKxU2N8MCKGoj2kfVC5ZM=6jj5v1NSjTkS2d8X6eOKcmbUiD2w@mail.gmail.com>
Date: Fri, 5 Sep 2025 13:05:38 -0700
From: Rosen Penev <rosenp@...il.com>
To: Vladimir Oltean <olteanv@...il.com>
Cc: netdev@...r.kernel.org, Horatiu Vultur <horatiu.vultur@...rochip.com>, 
	"maintainer:MICROCHIP LAN966X ETHERNET DRIVER" <UNGLinuxDriver@...rochip.com>, Andrew Lunn <andrew+netdev@...n.ch>, 
	"David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>, 
	Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>, 
	open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH net] net: lan966x: enforce phy-mode presence

On Fri, Sep 5, 2025 at 5:52 AM Vladimir Oltean <olteanv@...il.com> wrote:
>
> On Thu, Sep 04, 2025 at 01:38:34PM -0700, Rosen Penev wrote:
> > The documentation for lan966x states that phy-mode is a required
> > property but the code does not enforce this. Add an error check.
> >
> > Fixes: db8bcaad5393 ("net: lan966x: add the basic lan966x driver")
> > Signed-off-by: Rosen Penev <rosenp@...il.com>
> > ---
> >  drivers/net/ethernet/microchip/lan966x/lan966x_main.c | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_main.c b/drivers/net/ethernet/microchip/lan966x/lan966x_main.c
> > index 7001584f1b7a..5d28710f4fd2 100644
> > --- a/drivers/net/ethernet/microchip/lan966x/lan966x_main.c
> > +++ b/drivers/net/ethernet/microchip/lan966x/lan966x_main.c
> > @@ -1199,6 +1199,9 @@ static int lan966x_probe(struct platform_device *pdev)
> >                       continue;
> >
> >               phy_mode = fwnode_get_phy_mode(portnp);
> > +             if (phy_mode)
> > +                     goto cleanup_ports;
>
> It's not really great to submit bug fixes without testing them.
>
> /**
>  * fwnode_get_phy_mode - Get phy mode for given firmware node
>  * @fwnode:     Pointer to the given node
>  *
>  * The function gets phy interface string from property 'phy-mode' or
>  * 'phy-connection-type', and return its index in phy_modes table, or errno in
>  * error case.
>  */
>
> The test you add will only pass for phy-mode = "", where phy_mode will
> be PHY_INTERFACE_MODE_NA. Otherwise, it will be a negative error code,
> or a positive phy_interface_t value, and both will result in a "goto
> cleanup_ports".
>
> What is the impact of the problem? What happens without your fix?
According to Daniel Machon (one of the developers), it ends up working
with phy_mode missing.

In my OF conversion patch, I'm getting mixed messages on whether to
handle the error or not. I think I'll let someone else deal with this.
>
> > +
> >               err = lan966x_probe_port(lan966x, p, phy_mode, portnp);
> >               if (err)
> >                       goto cleanup_ports;
> > --
> > 2.51.0
> >
> >

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ