ALSA: harmony: initialize locks before requesting IRQ

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: 1da177e4c3 ("Linux-2.6.12-rc2")
Cc: [email protected]
Assisted-by: Codex:GPT-5
Signed-off-by: Runyu Xiao <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Takashi Iwai <[email protected]>
This commit is contained in:
Runyu Xiao authored and Takashi Iwai committed 2026-08-31 10:07:23 +02:00
1 parent a565d82392
commit 33abb7491e
1 file changed
+3 -3
+3 -3
View File
@@ -868,6 +868,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) {
@@ -877,9 +880,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;