[PATCH net] net: spacemit: Hold RTNL lock in emac_resume() and emac_suspend()
Ali Tariq
alitariq45892 at gmail.com
Fri Nov 6 02:44:50 PST 2026
On 11/6/26 2:43 PM, Troy Mitchell wrote:
> On Thu, 5 Nov 2026 17:34:37 +0500, Ali Tariq wrote:
>> @@ -2056,7 +2059,9 @@ static int emac_suspend(struct device *dev)
>> return 0;
>> }
>>
>> + rtnl_lock();
>> emac_stop(ndev);
>> + rtnl_unlock();
>>
>> clk_disable_unprepare(priv->bus_clk);
>> netif_device_detach(ndev);
> This can deadlock. emac_stop() -> emac_down() calls
> cancel_work_sync(&priv->tx_timeout_task) with RTNL now held, while
> emac_tx_timeout_task() starts with rtnl_lock().
>
Thanks Troy, that makes sense.
For the deadlock, I think the correct function to call is rtnl_trylock()
inside the emac_tx_timeout_task(), which would return if the lock is
already held and will hold the lock if it is not.
What are your thoughts on this? Does a v2 changing rtnl_lock() to
rtnl_trylock() inside emac_tx_timeout_task() make sense?
Regards,
Ali
More information about the linux-riscv
mailing list