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] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJq09z7Jd51b9GKAy7xUXr4cqdLT-bOLd-FaEDPn8eL9Da1bMg@mail.gmail.com>
Date: Thu, 4 Jan 2024 23:35:30 -0300
From: Luiz Angelo Daros de Luca <luizluca@...il.com>
To: Vladimir Oltean <vladimir.oltean@....com>
Cc: netdev@...r.kernel.org, "David S. Miller" <davem@...emloft.net>, 
	Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>, 
	Andrew Lunn <andrew@...n.ch>, Florian Fainelli <f.fainelli@...il.com>, 
	Alvin Šipraga <alsi@...g-olufsen.dk>, 
	Linus Walleij <linus.walleij@...aro.org>, Florian Fainelli <florian.fainelli@...adcom.com>, 
	Hauke Mehrtens <hauke@...ke-m.de>, Christian Marangi <ansuelsmth@...il.com>, 
	Arınç ÜNAL <arinc.unal@...nc9.com>
Subject: Re: [PATCH net-next 06/10] net: dsa: qca8k: assign ds->user_mii_bus
 only for the non-OF case

> To simplify reasoning about why the DSA framework provides the
> ds->user_mii_bus functionality, drivers should only use it if they
> need to. The qca8k driver appears to also use it simply as storage
> for a pointer, which is not a good enough reason to make the core
> much more difficult to follow.
>
> ds->user_mii_bus is useful for only 2 cases:
>
> 1. The driver probes on platform_data (no OF)
> 2. The driver probes on OF, but there is no OF node for the MDIO bus.
>
> It is unclear if case (1) is supported with qca8k. It might not be:
> the driver might crash when of_device_get_match_data() returns NULL
> and then it dereferences priv->info without NULL checking.

There are plenty of places that will not work without OF. For example,
qca8k_setup_mdio_bus will return -EINVAL without ports or
ethernet-ports in the device-tree.
That error will abort qca8k_setup. I think it is safe to assume case (2).

> Anyway, let us limit the ds->user_mii_bus usage only to the above cases,
> and not assign it when an OF node is present.
>
> The bus->phy_mask assignment follows along with the movement, because
> __of_mdiobus_register() overwrites this bus field anyway. The value set
> by the driver only matters for the non-OF code path.
>
> Signed-off-by: Vladimir Oltean <vladimir.oltean@....com>

Reviewed-by: Luiz Angelo Daros de Luca <luizluca@...il.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ