Skip to content

Commit

Permalink
net: dsa: lantiq_gswip: fix use after free in gswip_remove()
Browse files Browse the repository at this point in the history
commit 8c6ae46 upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
khoroshilov authored and gregkh committed Feb 23, 2022
1 parent b9bbab4 commit c61f599
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/net/dsa/lantiq_gswip.c
Expand Up @@ -2217,8 +2217,8 @@ static int gswip_remove(struct platform_device *pdev)

if (priv->ds->slave_mii_bus) {
mdiobus_unregister(priv->ds->slave_mii_bus);
mdiobus_free(priv->ds->slave_mii_bus);
of_node_put(priv->ds->slave_mii_bus->dev.of_node);
mdiobus_free(priv->ds->slave_mii_bus);
}

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

0 comments on commit c61f599

Please sign in to comment.