[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87o7i77p2p.wl-tiwai@suse.de>
Date: Tue, 12 Sep 2023 10:50:22 +0200
From: Takashi Iwai <tiwai@...e.de>
To: Ma Ke <make_ruc2021@....com>
Cc: perex@...ex.cz, tiwai@...e.com, cujomalainey@...omium.org,
maciej.szmigiero@...cle.com, clecigne@...gle.com,
alsa-devel@...a-project.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] ALSA: control: do not access controls without possession of r_w lock
On Tue, 12 Sep 2023 10:45:30 +0200,
Ma Ke wrote:
>
> we should not access any of its memory when we don't ensure possession of
> a read/write lock. Otherwise we risk a use after free access, which allows
> local users to cause a denial of service and obtain sensitive information
> from kernel memory.
This function is called always under card->controls_rwsem.
So it should be OK as is.
thanks,
Takashi
>
> Signed-off-by: Ma Ke <make_ruc2021@....com>
> ---
> sound/core/control.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/sound/core/control.c b/sound/core/control.c
> index 59c8658966d4..98782cc68ee1 100644
> --- a/sound/core/control.c
> +++ b/sound/core/control.c
> @@ -590,7 +590,8 @@ static int __snd_ctl_remove(struct snd_card *card,
> remove_hash_entries(card, kcontrol);
>
> card->controls_count -= kcontrol->count;
> - for (idx = 0; idx < kcontrol->count; idx++)
> + count = kcontrol->count;
> + for (idx = 0; idx < count; idx++)
> snd_ctl_notify_one(card, SNDRV_CTL_EVENT_MASK_REMOVE, kcontrol, idx);
> snd_ctl_free_one(kcontrol);
> return 0;
> --
> 2.37.2
>
Powered by blists - more mailing lists