From: Takashi Iwai <tiwai@suse.de>
To: Lv Yunlong <lyl2019@mail.ustc.edu.cn>
Cc: perex@perex.cz, tiwai@suse.com, alsa-devel@alsa-project.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] sound/isa/sb/emu8000: Fix a use after free in snd_emu8000_create_mixer
Date: Mon, 26 Apr 2021 16:23:15 +0200 [thread overview]
Message-ID: <s5ha6pl2kh8.wl-tiwai@suse.de> (raw)
In-Reply-To: <20210426131129.4796-1-lyl2019@mail.ustc.edu.cn>
On Mon, 26 Apr 2021 15:11:29 +0200,
Lv Yunlong wrote:
>
> Our code analyzer reported a uaf.
>
> In snd_emu8000_create_mixer, the callee snd_ctl_add(..,emu->controls[i])
> calls snd_ctl_add_replace(.., kcontrol,..). Inside snd_ctl_add_replace(),
> if error happens, kcontrol will be freed by snd_ctl_free_one(kcontrol).
> Then emu->controls[i] points to a freed memory, and the execution comes
> to __error branch of snd_emu8000_create_mixer. The freed emu->controls[i]
> is used in snd_ctl_remove(card, emu->controls[i]).
>
> My patch set emu->controls[i] to NULL if snd_ctl_add() failed to avoid
> the uaf.
>
> Signed-off-by: Lv Yunlong <lyl2019@mail.ustc.edu.cn>
Thanks, applied now.
The bug was hard to be seen due to the coding style, so we'd need a
cleanup, but it's a different story...
Takashi
next prev parent reply other threads:[~2021-04-26 14:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-26 13:11 Lv Yunlong
2021-04-26 14:23 ` Takashi Iwai [this message]
2021-04-26 14:38 ` Jaroslav Kysela
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=s5ha6pl2kh8.wl-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=alsa-devel@alsa-project.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lyl2019@mail.ustc.edu.cn \
--cc=perex@perex.cz \
--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®