[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a5236fe2-4e9b-49ef-9734-f3b60746896d@gmail.com>
Date: Thu, 4 Dec 2025 14:39:48 +0100
From: Jonas Gorski <jonas.gorski@...il.com>
To: Alexey Simakov <bigalex934@...il.com>,
Michael Chan <michael.chan@...adcom.com>
Cc: Andrew Lunn <andrew+netdev@...n.ch>, "David S. Miller"
<davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Michael Buesch <mb@...sch.de>, "John W. Linville" <linville@...driver.com>,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
lvc-project@...uxtesting.org
Subject: Re: [PATCH net] broadcom: b44: prevent uninitialized value usage
Hi,
On 12/4/25 06:22, 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 if an external PHY is used, that would
> also correspond to other b44_readphy() call sites.
>
> Found by Linux Verification Center (linuxtesting.org) with Svace.
>
> Fixes: 753f492093da ("[B44]: port to native ssb support")
> Signed-off-by: Alexey Simakov <bigalex934@...il.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..cbfd65881326 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 0;
Wouldn't the right fix here to call phy_ethtool_nway_reset(dev->phydev); instead
of just returning 0? That way it properly restarts auto-negotiation even in this
case.
> +
> spin_lock_irq(&bp->lock);
> b44_readphy(bp, MII_BMCR, &bmcr);
> b44_readphy(bp, MII_BMCR, &bmcr);
Best regards,
Jonas
Powered by blists - more mailing lists