From: sashiko-bot@kernel.org
To: "Sreeraj S Kurup" <sreekuttan2156239@gmail.com>
Cc: linux-sound@vger.kernel.org
Subject: Re: [PATCH] ALSA: vmaster: Check follower callback errors
Date: Thu, 26 Nov 2026 07:02:56 +0000 [thread overview]
Message-ID: <sashiko-outbox-234925@kernel.org> (raw)
In-Reply-To: <20261126065310.3451-1-sreekuttan2156239@gmail.com>
Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [Critical] ALSA: vmaster: use-after-free in sync_followers() [1]
--
commit e1ba86351d2c61db18d124cbf361fe1a670040d9
Author: Sreeraj S Kurup <sreekuttan2156239@gmail.com>
ALSA: vmaster: Check follower callback errors
This commit checks the return values of follower_get_val() and
follower_put_val() in sync_followers() and aborts synchronization on error.
> diff --git a/sound/core/vmaster.c b/sound/core/vmaster.c
> index f43144ba27978..88b38ee5ba5f6 100644
> --- a/sound/core/vmaster.c
> +++ b/sound/core/vmaster.c
> @@ -345,17 +345,27 @@ static int sync_followers(struct link_master *master, int old_val, int new_val)
> struct link_follower *follower;
> struct snd_ctl_elem_value *uval __free(kfree) =
> kmalloc_obj(*uval);
> + int err;
>
> if (!uval)
> return -ENOMEM;
> list_for_each_entry(follower, &master->followers, list) {
> master->val = old_val;
> uval->id = follower->follower.id;
> - follower_get_val(follower, uval);
> + err = follower_get_val(follower, uval);
[Severity: Critical]
This problem wasn't introduced by this patch, but can traversing
master->followers here cause a use-after-free on follower [1]?
When an unsolicited hotplug jack event calls snd_ctl_sync_vmaster(), it
invokes sync_followers() without holding card->controls_rwsem. A
concurrent snd_ctl_remove() can unlink and free a follower via
follower_free() while the list is being walked:
CPU0 CPU1
snd_ctl_sync_vmaster()
sync_followers()
list_for_each_entry(follower, &master->followers, list)
snd_ctl_remove()
follower_free()
list_del(&follower->list)
kfree(follower)
uval->id = follower->follower.id; <-- use-after-free
[1] https://sashiko.dev/#/bug/linux-922db78b-8e7d-4396-bf14-07bd594a9a8a
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261126065310.3451-1-sreekuttan2156239@gmail.com?part=1
next prev parent reply other threads:[~2026-11-26 7:02 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-26 6:53 [PATCH] ALSA: vmaster: Check follower callback errors Sreeraj S Kurup
2026-11-26 7:02 ` sashiko-bot [this message]
2026-11-27 17:31 ` Takashi Iwai
2026-11-28 8:16 ` Sreeraj S Kurup
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=sashiko-outbox-234925@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=sreekuttan2156239@gmail.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 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.