Skip to content

Commit 8c6ae46

Browse files
khoroshilovkuba-moo
authored andcommitted
net: dsa: lantiq_gswip: fix use after free in gswip_remove()
of_node_put(priv->ds->slave_mii_bus->dev.of_node) should be done before mdiobus_free(priv->ds->slave_mii_bus). Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru> Fixes: 0d120df ("net: dsa: lantiq_gswip: don't use devres for mdiobus") Reviewed-by: Andrew Lunn <andrew@lunn.ch> Link: https://lore.kernel.org/r/1644921768-26477-1-git-send-email-khoroshilov@ispras.ru Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 0b0dff5 commit 8c6ae46

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/net/dsa/lantiq_gswip.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2176,8 +2176,8 @@ static int gswip_remove(struct platform_device *pdev)
21762176

21772177
if (priv->ds->slave_mii_bus) {
21782178
mdiobus_unregister(priv->ds->slave_mii_bus);
2179-
mdiobus_free(priv->ds->slave_mii_bus);
21802179
of_node_put(priv->ds->slave_mii_bus->dev.of_node);
2180+
mdiobus_free(priv->ds->slave_mii_bus);
21812181
}
21822182

21832183
for (i = 0; i < priv->num_gphy_fw; i++)

0 commit comments

Comments
 (0)