Re: [PATCH 5.10 073/116] net: dsa: lantiq_gswip: dont use devres for mdiobus

Vladimir Oltean
2022-02-15T09:45:57Z

On Tue, Feb 15, 2022 at 12:35:44PM +0300, Alexey Khoroshilov wrote:
> > 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);
> > }
>
>
> Should
> of_node_put(priv->ds->slave_mii_bus->dev.of_node);
> be here before
> mdiobus_free(priv->ds->slave_mii_bus);
> ?

Thanks for noticing. Yes, this would avoid a use-after-free.
Do you mind sending a patch to correct this?