From: Takashi Iwai <tiwai@suse.de>
To: Hanxiang Xu <xuhx@hust.edu.cn>
Cc: Takashi Iwai <tiwai@suse.com>, Jaroslav Kysela <perex@perex.cz>,
linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ALSA: core: serialize card->devices operations with a re-entrant devices lock
Date: Wed, 02 Dec 2026 09:56:50 +0100 [thread overview]
Message-ID: <87ik1cxdpp.wl-tiwai@suse.de> (raw)
In-Reply-To: <20261202100602.1-1-xuhx@hust.edu.cn>
On Wed, 02 Dec 2026 03:06:02 +0100,
Hanxiang Xu wrote:
>
> The card->devices list is manipulated with no serialization:
> snd_device_free() does list_del() and kfree(dev) while
> snd_device_disconnect_all() walks the list dereferencing every entry,
> so an independently removable sub-driver racing a card disconnect makes
> the walker read freed memory or advance through LIST_POISON2 and Oops.
>
> Add a devices_mutex to struct snd_card and take it in
> snd_device_new()/snd_device_free()/snd_device_disconnect()/
> snd_device_register()/snd_device_register_all()/
> snd_device_disconnect_all()/snd_device_free_all(). The lock tracks its
> owner so the legitimate re-entrancy keeps working: disconnect callbacks
> run under the lock and may themselves call snd_device_free() for
> sibling devices (the sequencer sub-driver remove path).
>
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Hanxiang Xu <xuhx@hust.edu.cn>
This change conflicts with your other patch?
Manage your own patches better at first.
Takashi
prev parent reply other threads:[~2026-12-02 8:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-02 2:06 [PATCH] ALSA: core: serialize card->devices operations with a re-entrant devices lock Hanxiang Xu
2026-12-02 3:22 ` sashiko-bot
2026-12-02 8:56 ` Takashi Iwai [this message]
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=87ik1cxdpp.wl-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
--cc=tiwai@suse.com \
--cc=xuhx@hust.edu.cn \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.