Re: [PATCH] module: replace the mutex lock acquisition method

From: Lizhi Xu
Date: Fri Feb 21 2025 - 20:02:48 EST


On Fri, 21 Feb 2025 21:07:59 +0100, Rafael J. Wysocki" <rafael@xxxxxxxxxx> wrote:
> > syzbot reported a deadlock in lock_system_sleep. [1]
> >
> > The write operation to "/sys/module/hibernate/parameters/compressor"
> > conflicts with the registration of ieee80211 device, resulting in a deadlock
> > in the lock param_lock.
> >
> > Since the conflict cannot be avoided, the way to obtain param_lock is changed
> > to trylock to avoid deadlock.
>
> An alternative way to avoid the deadlock would be to replace
> lock_system_sleep() in hibernate_compressor_param_set() with
> mutex_trylock(&system_transition_mutex) (and analogously for the
> unlock operation). Why have you not done that?
Yes, you are right, I have confirmed that can work fine.
I will send V2 patch for using mutex_trylock(&system_transition_mutex).

BR,
Lizhi