From: "Ali Ahmet Memiş" <aliamemis@disroot.org>
To: Takashi Iwai <tiwai@suse.de>
Cc: 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 18:09:41 +0300 [thread overview]
Message-ID: <20261012150949.1840175-1-aliamemis@disroot.org> (raw)
In-Reply-To: <87fqybge5a.wl-tiwai@suse.de>
On Mon, 12 Oct 2026 16:57:37 +0200, Takashi Iwai wrote:
> OK, that's a problem, indeed. How about replacing snd_card_free()
> with *_when_closed() version that doesn't block in addition?
The work doesn't hang anymore but removing the device while the probe
work is running hits the same UAF on the first try. azx_remove() still
gets the card before cancel_delayed_work_sync() and the put_device() in
the work frees it:
BUG: KASAN: slab-use-after-free in snd_card_free+0x148/0x160
Read of size 1 at addr ffff888007724852 by task sh/97
Call Trace:
snd_card_free+0x148/0x160
pci_device_remove+0xb6/0x1d0
device_release_driver_internal+0x38d/0x540
pci_stop_bus_device+0x122/0x170
...
Freed by task 30:
kfree+0x1e8/0x5e0
device_release+0xcf/0x3c0
kobject_put+0x169/0x320
azx_probe_work+0x495/0x1fa0
process_one_work+0x937/0x1800
> 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.
What about calling snd_card_disconnect() in the work on failure? It
releases the slot right away and the card is still freed only in
azx_remove():
if (azx_probe_continue(&hda->chip, false) < 0) {
hda->init_failed = 1;
complete_all(&hda->probe_wait);
snd_card_disconnect(hda->chip.card);
}
With that, snd-dummy loaded after a failed probe gets card 0 and 20
rounds of the remove race were clean with KASAN. I can send v2 if this
looks fine.
next prev parent reply other threads:[~2026-10-12 15:10 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
2026-10-12 15:09 ` Ali Ahmet Memiş [this message]
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=20261012150949.1840175-1-aliamemis@disroot.org \
--to=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 \
--cc=tiwai@suse.de \
/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®