| From 70efbb7942e73ddd6d3c935308ab3dc279b807c3 Mon Sep 17 00:00:00 2001 | |
| From: Sasha Levin <sashal@kernel.org> | |
| Date: Thu, 10 Sep 2026 15:08:33 -0400 | |
| Subject: ALSA: harmony: initialize locks before requesting IRQ | |
| From: Runyu Xiao <runyu.xiao@seu.edu.cn> | |
| [ Upstream commit 33abb7491e89285a41565670945293dda841afc4 ] | |
| snd_harmony_create() registers the IRQ before initializing h->lock and | |
| h->mixer_lock. A pending interrupt can invoke the handler while these | |
| locks are uninitialized. | |
| Initialize both locks before requesting the IRQ so the handler always | |
| sees valid lock state. | |
| Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") | |
| Cc: stable@vger.kernel.org | |
| Assisted-by: Codex:GPT-5 | |
| Signed-off-by: Runyu Xiao <runyu.xiao@seu.edu.cn> | |
| Link: https://patch.msgid.link/20260830063411.2215691-1-runyu.xiao@seu.edu.cn | |
| Signed-off-by: Takashi Iwai <tiwai@suse.de> | |
| Signed-off-by: Sasha Levin <sashal@kernel.org> | |
| --- | |
| sound/parisc/harmony.c | 6 +++--- | |
| 1 file changed, 3 insertions(+), 3 deletions(-) | |
| diff --git a/sound/parisc/harmony.c b/sound/parisc/harmony.c | |
| index 1440db8b4177f..f5cbcf7a7469a 100644 | |
| --- a/sound/parisc/harmony.c | |
| +++ b/sound/parisc/harmony.c | |
| @@ -903,6 +903,9 @@ snd_harmony_create(struct snd_card *card, | |
| goto free_and_ret; | |
| } | |
| + spin_lock_init(&h->mixer_lock); | |
| + spin_lock_init(&h->lock); | |
| + | |
| err = request_irq(padev->irq, snd_harmony_interrupt, 0, | |
| "harmony", h); | |
| if (err) { | |
| @@ -912,9 +915,6 @@ snd_harmony_create(struct snd_card *card, | |
| } | |
| h->irq = padev->irq; | |
| - spin_lock_init(&h->mixer_lock); | |
| - spin_lock_init(&h->lock); | |
| - | |
| err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, h, &ops); | |
| if (err < 0) | |
| goto free_and_ret; | |
| -- | |
| 2.53.0 | |