Skip to content

Commit 42b998d

Browse files
AnsuelPaolo Abeni
authored andcommitted
net: dsa: qca8k: fix NULL pointer dereference for of_device_get_match_data
of_device_get_match_data is called on priv->dev before priv->dev is actually set. Move of_device_get_match_data after priv->dev is correctly set to fix this kernel panic. Fixes: 3bb0844 ("net: dsa: qca8k: cache match data to speed up access") Signed-off-by: Christian Marangi <[email protected]> Reviewed-by: Vladimir Oltean <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
1 parent 686dc2d commit 42b998d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/net/dsa/qca/qca8k-8xxx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1889,9 +1889,9 @@ qca8k_sw_probe(struct mdio_device *mdiodev)
18891889
if (!priv)
18901890
return -ENOMEM;
18911891

1892-
priv->info = of_device_get_match_data(priv->dev);
18931892
priv->bus = mdiodev->bus;
18941893
priv->dev = &mdiodev->dev;
1894+
priv->info = of_device_get_match_data(priv->dev);
18951895

18961896
priv->reset_gpio = devm_gpiod_get_optional(priv->dev, "reset",
18971897
GPIOD_ASIS);

0 commit comments

Comments
 (0)