drivers/net/ethernet/broadcom/b44.c | 3 +++ 1 file changed, 3 insertions(+)
On execution path with raised B44_FLAG_EXTERNAL_PHY, b44_readphy()
leaves bmcr value uninitialized and it is used later in the code.
Add check of this flag at the beginning of the b44_nway_reset() and
exit early of the function with restarting autonegotiation if an
external PHY is used.
Found by Linux Verification Center (linuxtesting.org) with Svace.
Fixes: 753f492093da ("[B44]: port to native ssb support")
Signed-off-by: Alexey Simakov <bigalex934@gmail.com>
---
v2 - add restarting of autonegotiations by phy_ethtool_nway_reset(),
instead of returning with 0 code (suggested by Jonas Gorski).
link to v1: https://lore.kernel.org/all/20251204052243.5824-1-bigalex934@gmail.com/
drivers/net/ethernet/broadcom/b44.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/ethernet/broadcom/b44.c b/drivers/net/ethernet/broadcom/b44.c
index 0353359c3fe9..073d7d490d4b 100644
--- a/drivers/net/ethernet/broadcom/b44.c
+++ b/drivers/net/ethernet/broadcom/b44.c
@@ -1789,6 +1789,9 @@ static int b44_nway_reset(struct net_device *dev)
u32 bmcr;
int r;
+ if (bp->flags & B44_FLAG_EXTERNAL_PHY)
+ return phy_ethtool_nway_reset(dev);
+
spin_lock_irq(&bp->lock);
b44_readphy(bp, MII_BMCR, &bmcr);
b44_readphy(bp, MII_BMCR, &bmcr);
--
2.34.1
On Fri, Dec 05, 2025 at 10:17:58AM +0300, Alexey Simakov wrote:
> On execution path with raised B44_FLAG_EXTERNAL_PHY, b44_readphy()
> leaves bmcr value uninitialized and it is used later in the code.
>
> Add check of this flag at the beginning of the b44_nway_reset() and
> exit early of the function with restarting autonegotiation if an
> external PHY is used.
>
> Found by Linux Verification Center (linuxtesting.org) with Svace.
>
> Fixes: 753f492093da ("[B44]: port to native ssb support")
> Signed-off-by: Alexey Simakov <bigalex934@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Andrew
On 12/5/25 8:17 AM, Alexey Simakov wrote:
> On execution path with raised B44_FLAG_EXTERNAL_PHY, b44_readphy()
> leaves bmcr value uninitialized and it is used later in the code.
>
> Add check of this flag at the beginning of the b44_nway_reset() and
> exit early of the function with restarting autonegotiation if an
> external PHY is used.
>
> Found by Linux Verification Center (linuxtesting.org) with Svace.
>
> Fixes: 753f492093da ("[B44]: port to native ssb support")
> Signed-off-by: Alexey Simakov <bigalex934@gmail.com>
You need to include the netdev ML in the recipients list to get this
patch processed.
Thanks,
Paolo
On Fri, Dec 5, 2025 at 8:18 AM Alexey Simakov <bigalex934@gmail.com> wrote:
>
> On execution path with raised B44_FLAG_EXTERNAL_PHY, b44_readphy()
> leaves bmcr value uninitialized and it is used later in the code.
>
> Add check of this flag at the beginning of the b44_nway_reset() and
> exit early of the function with restarting autonegotiation if an
> external PHY is used.
>
> Found by Linux Verification Center (linuxtesting.org) with Svace.
>
> Fixes: 753f492093da ("[B44]: port to native ssb support")
> Signed-off-by: Alexey Simakov <bigalex934@gmail.com>
> ---
>
> v2 - add restarting of autonegotiations by phy_ethtool_nway_reset(),
> instead of returning with 0 code (suggested by Jonas Gorski).
>
> link to v1: https://lore.kernel.org/all/20251204052243.5824-1-bigalex934@gmail.com/
>
> drivers/net/ethernet/broadcom/b44.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/net/ethernet/broadcom/b44.c b/drivers/net/ethernet/broadcom/b44.c
> index 0353359c3fe9..073d7d490d4b 100644
> --- a/drivers/net/ethernet/broadcom/b44.c
> +++ b/drivers/net/ethernet/broadcom/b44.c
> @@ -1789,6 +1789,9 @@ static int b44_nway_reset(struct net_device *dev)
> u32 bmcr;
> int r;
>
> + if (bp->flags & B44_FLAG_EXTERNAL_PHY)
> + return phy_ethtool_nway_reset(dev);
Thanks for double checking and not blindly copying my suggestion lol.
(phy_ethtool_nway_reset() takes a net_device *, not a phy_device *
...).
In that sense,
Reviewed-by: Jonas Gorski <jonas.gorski@gmail.com>
Best regards,
Jonas
© 2016 - 2025 Red Hat, Inc.