broadcom: b44: prevent uninitialized value usage
Subsystems (3)
PATCH v3 1/1 broadcom: b44: prevent uninitialized value usage
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.
---
v2 - add restarting of autonegotiations by phy_ethtool_nway_reset(), instead of returning with 0 code (suggested by Jonas Gorski).
v3 - add needed mailing list into Cc.
link to v1: https://lore.kernel.org/all/[email protected]/
link to v2: https://lore.kernel.org/all/[email protected]/
drivers/net/ethernet/broadcom/b44.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/ethernet/broadcom/b44.c +3 -0
@@ -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);
Signature · 1 line
2.34.1
Quoted 8 lines · Alexey Simakov
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.
Quoted 6 lines
Found by Linux Verification Center (linuxtesting.org) with Svace.
Fixes 753f492093da ("[B44]: port to native ssb support")Reviewed-by Jonas Gorski <[email protected]>Reviewed-by Andrew Lunn <[email protected]>Signed-off-by Alexey Simakov <[email protected]>
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:
Quoted 8 lines · On Fri, 5 Dec 2025 18:58:16 +0300 you 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.[...]
Here is the summary with links:
- [net,v3] broadcom: b44: prevent uninitialized value usage
https://git.kernel.org/netdev/net/c/50b3db3e1186
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html