]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
broadcom: b44: prevent uninitialized value usage
authorAlexey Simakov <bigalex934@gmail.com>
Fri, 5 Dec 2025 15:58:16 +0000 (18:58 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 19 Jan 2026 12:09:43 +0000 (13:09 +0100)
[ Upstream commit 50b3db3e11864cb4e18ff099cfb38e11e7f87a68 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/broadcom/b44.c

index ce370ef641f017b71d03017fb0fafe16cada9b6b..3c4e0a78b8a0322d7cc087e1d9234347b8ac7bd9 100644 (file)
@@ -1811,6 +1811,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);