Re: [PATCH] ALSA: aloop: Fix &cable->lock deadlock issues
From: Takashi Iwai
Date: Sun Jun 25 2023 - 14:14:29 EST
On Sun, 25 Jun 2023 18:22:56 +0200,
YE Chengfeng wrote:
>
> The timer loopback_jiffies_timer_function is executed under
> bottom-half softirq context and require a spinlock, thus
> other process context code requiring the same lock (i.e.,
> loopback_trigger, loopback_pointer) can deadlock with the
> timer if it is preempted while holding the lock.
>
> Deadlock scenario:
> loopback_trigger
> -> spin_lock(&cable->lock);
> <timer interrupt>
> -> loopback_jiffies_timer_function
> -> spin_lock_irqsave(&dpcm->cable->lock, flags);
>
> Fix the potential deadlock by using spin_lock_irqsave.
Similarly like the patch for snd-dummy, this change looks superfluous,
too.
thanks,
Takashi