* [PATCH v2] ALSA: hda: intel: Don't free card in the probe work
@ 2026-10-12 16:28 Ali Ahmet Memiş
2026-10-13 7:01 ` Takashi Iwai
0 siblings, 1 reply; 2+ messages in thread
From: Ali Ahmet Memiş @ 2026-10-12 16:28 UTC (permalink / raw)
To: Takashi Iwai, Jaroslav Kysela
Cc: linux-sound, linux-kernel, syzbot+40b06a86af225236fdb4
If the delayed probe fails, azx_probe_work() frees the card and clears
the drvdata. azx_remove() reads the card before it waits for the probe
work with cancel_delayed_work_sync() so when the device is removed while
the probe work is running, it frees the card again after the work has
already freed it.
Only disconnect the card in the work so that its slot is released right
away and leave freeing it to azx_remove().
Fixes: 39173303c838 ("ALSA: hda: Free card instance properly at probe errors")
Reported-by: syzbot+40b06a86af225236fdb4@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=40b06a86af225236fdb4
Signed-off-by: Ali Ahmet Memiş <aliamemis@disroot.org>
---
v2: disconnect the card in the work so that the slot is released (Takashi)
v1: https://lore.kernel.org/all/20261011200648.1662935-1-aliamemis@disroot.org/
sound/hda/controllers/intel.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/sound/hda/controllers/intel.c b/sound/hda/controllers/intel.c
index 2b5b5d555f2c..6b80b59b8743 100644
--- a/sound/hda/controllers/intel.c
+++ b/sound/hda/controllers/intel.c
@@ -1737,7 +1737,12 @@ static void azx_check_snoop_available(struct azx *chip)
static void azx_probe_work(struct work_struct *work)
{
struct hda_intel *hda = container_of(work, struct hda_intel, probe_work.work);
- azx_probe_continue(&hda->chip, true);
+
+ if (azx_probe_continue(&hda->chip, false) < 0) {
+ hda->init_failed = 1;
+ complete_all(&hda->probe_wait);
+ snd_card_disconnect(hda->chip.card);
+ }
}
static int default_bdl_pos_adj(struct azx *chip)
--
2.55.0
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH v2] ALSA: hda: intel: Don't free card in the probe work
2026-10-12 16:28 [PATCH v2] ALSA: hda: intel: Don't free card in the probe work Ali Ahmet Memiş
@ 2026-10-13 7:01 ` Takashi Iwai
0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2026-10-13 7:01 UTC (permalink / raw)
To: Ali Ahmet Memiş
Cc: Takashi Iwai, Jaroslav Kysela, linux-sound, linux-kernel,
syzbot+40b06a86af225236fdb4
On Mon, 12 Oct 2026 18:28:16 +0200,
Ali Ahmet Memiş wrote:
>
> If the delayed probe fails, azx_probe_work() frees the card and clears
> the drvdata. azx_remove() reads the card before it waits for the probe
> work with cancel_delayed_work_sync() so when the device is removed while
> the probe work is running, it frees the card again after the work has
> already freed it.
>
> Only disconnect the card in the work so that its slot is released right
> away and leave freeing it to azx_remove().
>
> Fixes: 39173303c838 ("ALSA: hda: Free card instance properly at probe errors")
> Reported-by: syzbot+40b06a86af225236fdb4@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=40b06a86af225236fdb4
> Signed-off-by: Ali Ahmet Memiş <aliamemis@disroot.org>
Applied to for-next branch now. Thanks.
Takashi
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-10-13 7:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-12 16:28 [PATCH v2] ALSA: hda: intel: Don't free card in the probe work Ali Ahmet Memiş
2026-10-13 7:01 ` Takashi Iwai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®