* [PATCH net 0/1] net: stmmac: dwmac-nuvoton: fix NULL pointer dereference in nvt_set_phy_intf_sel()
@ 2026-05-06 8:46 Joey Lu
2026-05-06 8:46 ` [PATCH net 1/1] " Joey Lu
2026-05-07 15:50 ` [PATCH net 0/1] " patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Joey Lu @ 2026-05-06 8:46 UTC (permalink / raw)
To: andrew+netdev, davem, edumazet, kuba, pabeni, mcoquelin.stm32
Cc: alexandre.torgue, linux-arm-kernel, netdev, linux-stm32,
linux-kernel, Joey Lu
This series fixes a NULL pointer dereference bug introduced in the
initial dwmac-nuvoton glue driver. The struct nvt_priv_data::dev field
was never initialized after devm_kzalloc(), leaving it NULL. When
phylink later calls nvt_set_phy_intf_sel() for interface selection,
the callback dereferences priv->dev via nvt_gmac_get_delay(), triggering
a NULL pointer dereference.
Joey Lu (1):
net: stmmac: dwmac-nuvoton: fix NULL pointer dereference in
nvt_set_phy_intf_sel()
drivers/net/ethernet/stmicro/stmmac/dwmac-nuvoton.c | 2 ++
1 file changed, 2 insertions(+)
--
2.43.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH net 1/1] net: stmmac: dwmac-nuvoton: fix NULL pointer dereference in nvt_set_phy_intf_sel()
2026-05-06 8:46 [PATCH net 0/1] net: stmmac: dwmac-nuvoton: fix NULL pointer dereference in nvt_set_phy_intf_sel() Joey Lu
@ 2026-05-06 8:46 ` Joey Lu
2026-05-07 15:50 ` [PATCH net 0/1] " patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Joey Lu @ 2026-05-06 8:46 UTC (permalink / raw)
To: andrew+netdev, davem, edumazet, kuba, pabeni, mcoquelin.stm32
Cc: alexandre.torgue, linux-arm-kernel, netdev, linux-stm32,
linux-kernel, Joey Lu
priv->dev was never initialized after devm_kzalloc() allocates the
private data structure. When nvt_set_phy_intf_sel() is later invoked
via the phylink interface_select callback, it calls
nvt_gmac_get_delay(priv->dev, ...) which dereferences the NULL pointer.
Fix this by assigning priv->dev = dev immediately after allocation.
Fixes: 4d7c557f58ef ("net: stmmac: dwmac-nuvoton: Add dwmac glue for Nuvoton MA35 family")
Signed-off-by: Joey Lu <a0987203069@gmail.com>
---
drivers/net/ethernet/stmicro/stmmac/dwmac-nuvoton.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-nuvoton.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-nuvoton.c
index e2240b68ad98..2ab6ecac6422 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-nuvoton.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-nuvoton.c
@@ -100,6 +100,8 @@ static int nvt_gmac_probe(struct platform_device *pdev)
if (!priv)
return dev_err_probe(dev, -ENOMEM, "Failed to allocate private data\n");
+ priv->dev = dev;
+
priv->regmap = syscon_regmap_lookup_by_phandle_args(dev->of_node, "nuvoton,sys",
1, &priv->macid);
if (IS_ERR(priv->regmap))
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net 0/1] net: stmmac: dwmac-nuvoton: fix NULL pointer dereference in nvt_set_phy_intf_sel()
2026-05-06 8:46 [PATCH net 0/1] net: stmmac: dwmac-nuvoton: fix NULL pointer dereference in nvt_set_phy_intf_sel() Joey Lu
2026-05-06 8:46 ` [PATCH net 1/1] " Joey Lu
@ 2026-05-07 15:50 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-05-07 15:50 UTC (permalink / raw)
To: Joey Lu
Cc: andrew+netdev, davem, edumazet, kuba, pabeni, mcoquelin.stm32,
alexandre.torgue, linux-arm-kernel, netdev, linux-stm32,
linux-kernel
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Wed, 6 May 2026 16:46:12 +0800 you wrote:
> This series fixes a NULL pointer dereference bug introduced in the
> initial dwmac-nuvoton glue driver. The struct nvt_priv_data::dev field
> was never initialized after devm_kzalloc(), leaving it NULL. When
> phylink later calls nvt_set_phy_intf_sel() for interface selection,
> the callback dereferences priv->dev via nvt_gmac_get_delay(), triggering
> a NULL pointer dereference.
>
> [...]
Here is the summary with links:
- [net,1/1] net: stmmac: dwmac-nuvoton: fix NULL pointer dereference in nvt_set_phy_intf_sel()
https://git.kernel.org/netdev/net/c/dedf6c90386d
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:[~2026-05-07 15:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-06 8:46 [PATCH net 0/1] net: stmmac: dwmac-nuvoton: fix NULL pointer dereference in nvt_set_phy_intf_sel() Joey Lu
2026-05-06 8:46 ` [PATCH net 1/1] " Joey Lu
2026-05-07 15:50 ` [PATCH net 0/1] " 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