From: Takashi Iwai <tiwai@suse.de>
To: "Ali Ahmet Memiş" <aliamemis@disroot.org>
Cc: Takashi Iwai <tiwai@suse.de>, Takashi Iwai <tiwai@suse.com>,
Jaroslav Kysela <perex@perex.cz>,
linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org,
syzbot+40b06a86af225236fdb4@syzkaller.appspotmail.com
Subject: Re: [PATCH] ALSA: hda: intel: Don't free card in the probe work
Date: Mon, 12 Oct 2026 16:57:37 +0200 [thread overview]
Message-ID: <87fqybge5a.wl-tiwai@suse.de> (raw)
In-Reply-To: <20261012143508.1830791-1-aliamemis@disroot.org>
On Mon, 12 Oct 2026 16:35:05 +0200,
Ali Ahmet Memiş wrote:
>
> On Mon, 12 Oct 2026 09:19:36 +0200, Takashi Iwai wrote:
> > For avoiding the card free, can it be the refcounting like below
> > instead?
>
> I tried it in QEMU and it hangs on every failed delayed probe even
> without a remove. snd_card_free() waits for the release of card_dev,
> but the reference taken in azx_probe_work() is dropped only after
> azx_probe_continue() returns, so the work never finishes:
>
> kworker/1:1+events:
> [<0>] snd_card_free+0x107/0x160
> [<0>] azx_probe_work+0x57d/0x1fa0
> [<0>] process_one_work+0x937/0x1800
> [<0>] worker_thread+0x4ba/0xd20
> [<0>] kthread+0x331/0x420
>
> It also doesn't help azx_remove() which reads the card without a
> reference before cancel_delayed_work_sync() and frees it again after
> the work.
OK, that's a problem, indeed. How about replacing snd_card_free()
with *_when_closed() version that doesn't block in addition?
--- a/sound/hda/controllers/intel.c
+++ b/sound/hda/controllers/intel.c
@@ -2450,7 +2450,7 @@ static int azx_probe_continue(struct azx *chip, bool free_on_error)
dev_warn(&pci->dev, "GPU sound probed, but not operational: please add a quirk to driver_denylist\n");
if (free_on_error) {
pci_set_drvdata(pci, NULL);
- snd_card_free(chip->card);
+ snd_card_free_when_closed(chip->card);
}
return err;
}
> Which user-visible change did you mean? The card now stays until the
> device is removed instead of being freed in the work.
Staying the card means that the card slot will be kept, then if you
probe another card afterwards, it'll end up with assignment on another
card slot.
thanks,
Takashi
next prev parent reply other threads:[~2026-10-12 14:57 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-11 20:06 Ali Ahmet Memiş
2026-10-12 7:19 ` Takashi Iwai
2026-10-12 14:35 ` Ali Ahmet Memiş
2026-10-12 14:57 ` Takashi Iwai [this message]
2026-10-12 15:09 ` Ali Ahmet Memiş
2026-10-12 15:56 ` Takashi Iwai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87fqybge5a.wl-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=aliamemis@disroot.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
--cc=syzbot+40b06a86af225236fdb4@syzkaller.appspotmail.com \
--cc=tiwai@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®