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

From: Alexey Khoroshilov
Date: Tue Feb 15 2022 - 05:06:36 EST


On 15.02.2022 12:45, Vladimir Oltean wrote:
> 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?
>

Surely, I will do.

--
Alexey