Skip to content

Commit dedf6c9

Browse files
yenchouRJkuba-moo
authored andcommitted
net: stmmac: dwmac-nuvoton: fix NULL pointer dereference in nvt_set_phy_intf_sel()
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: 4d7c557 ("net: stmmac: dwmac-nuvoton: Add dwmac glue for Nuvoton MA35 family") Signed-off-by: Joey Lu <a0987203069@gmail.com> Link: https://patch.msgid.link/20260506084614.192894-2-a0987203069@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent ecddc52 commit dedf6c9

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

drivers/net/ethernet/stmicro/stmmac/dwmac-nuvoton.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ static int nvt_gmac_probe(struct platform_device *pdev)
100100
if (!priv)
101101
return dev_err_probe(dev, -ENOMEM, "Failed to allocate private data\n");
102102

103+
priv->dev = dev;
104+
103105
priv->regmap = syscon_regmap_lookup_by_phandle_args(dev->of_node, "nuvoton,sys",
104106
1, &priv->macid);
105107
if (IS_ERR(priv->regmap))

0 commit comments

Comments
 (0)