]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
broadcom: b44: prevent uninitialized value usage
authorAlexey Simakov <bigalex934@gmail.com>
Fri, 5 Dec 2025 15:58:16 +0000 (18:58 +0300)
committerJakub Kicinski <kuba@kernel.org>
Wed, 10 Dec 2025 09:02:20 +0000 (01:02 -0800)
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.

Fixes: 753f492093da ("[B44]: port to native ssb support")
Reviewed-by: Jonas Gorski <jonas.gorski@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Alexey Simakov <bigalex934@gmail.com>
Reviewed-by: Michael Chan <michael.chan@broadcom.com>
Link: https://patch.msgid.link/20251205155815.4348-1-bigalex934@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/broadcom/b44.c

index 888f28f11406fb02bd297a30d5537e53d12fe9e4..90df02e0039cbacc57df1de0d9e0b564672da53d 100644 (file)
@@ -1790,6 +1790,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);