The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH net v3] broadcom: b44: prevent uninitialized value usage
@ 2025-12-05 15:58 Alexey Simakov
  2025-12-05 17:22 ` Michael Chan
  2025-12-10  9:20 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Alexey Simakov @ 2025-12-05 15:58 UTC (permalink / raw)
  To: Michael Chan
  Cc: Alexey Simakov, Andrew Lunn, Jonas Gorski, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, John W. Linville,
	Michael Buesch, netdev, linux-kernel, Andrew Lunn

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")
Reviewed-by: Jonas Gorski <jonas.gorski@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
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).

v3 - add needed mailing list into Cc.

link to v1: https://lore.kernel.org/all/20251204052243.5824-1-bigalex934@gmail.com/
link to v2: https://lore.kernel.org/all/20251205071759.5054-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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net v3] broadcom: b44: prevent uninitialized value usage
  2025-12-05 15:58 [PATCH net v3] broadcom: b44: prevent uninitialized value usage Alexey Simakov
@ 2025-12-05 17:22 ` Michael Chan
  2025-12-10  9:20 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Chan @ 2025-12-05 17:22 UTC (permalink / raw)
  To: Alexey Simakov
  Cc: Andrew Lunn, Jonas Gorski, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, John W. Linville, Michael Buesch,
	netdev, linux-kernel, Andrew Lunn

[-- Attachment #1: Type: text/plain, Size: 736 bytes --]

On Fri, Dec 5, 2025 at 7:59 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")
> 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>

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 5469 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net v3] broadcom: b44: prevent uninitialized value usage
  2025-12-05 15:58 [PATCH net v3] broadcom: b44: prevent uninitialized value usage Alexey Simakov
  2025-12-05 17:22 ` Michael Chan
@ 2025-12-10  9:20 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-12-10  9:20 UTC (permalink / raw)
  To: Alexey Simakov
  Cc: michael.chan, andrew+netdev, jonas.gorski, davem, edumazet, kuba,
	pabeni, linville, mb, netdev, linux-kernel, andrew

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

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!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-12-10  9:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-05 15:58 [PATCH net v3] broadcom: b44: prevent uninitialized value usage Alexey Simakov
2025-12-05 17:22 ` Michael Chan
2025-12-10  9:20 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox