From: Takashi Iwai <tiwai@suse.de>
To: "Nick Desaulniers" <ndesaulniers@google.com>
Cc: <alsa-devel@alsa-project.org>, <keescook@chromium.org>,
"Arvind Yadav" <arvind.yadav.cs@gmail.com>,
"Robb Glasser" <rglasser@google.com>,
"Jaroslav Kysela" <perex@perex.cz>,
"Takashi Sakamoto" <o-takashi@sakamocchi.jp>,
"Markus Elfring" <elfring@users.sourceforge.net>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] ALSA: pcm: prevent UAF in snd_pcm_info
Date: Tue, 05 Dec 2017 20:14:23 +0100 [thread overview]
Message-ID: <s5hvahldm28.wl-tiwai@suse.de> (raw)
In-Reply-To: <20171205171657.74392-1-ndesaulniers@google.com>
On Tue, 05 Dec 2017 18:16:55 +0100,
Nick Desaulniers wrote:
>
> From: Robb Glasser <rglasser@google.com>
>
> When the device descriptor is closed, the `substream->runtime` pointer
> is freed. But another thread may be in the ioctl handler, case
> SNDRV_CTL_IOCTL_PCM_INFO. This case calls snd_pcm_info_user() which
> calls snd_pcm_info() which accesses the now freed `substream->runtime`.
>
> Signed-off-by: Robb Glasser <rglasser@google.com>
> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Looks reasonable. Applied with Cc to stable now.
thanks,
Takashi
> ---
> sound/core/pcm.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/sound/core/pcm.c b/sound/core/pcm.c
> index 9070f277f8db..09ee8c6b9f75 100644
> --- a/sound/core/pcm.c
> +++ b/sound/core/pcm.c
> @@ -153,7 +153,9 @@ static int snd_pcm_control_ioctl(struct snd_card *card,
> err = -ENXIO;
> goto _error;
> }
> + mutex_lock(&pcm->open_mutex);
> err = snd_pcm_info_user(substream, info);
> + mutex_unlock(&pcm->open_mutex);
> _error:
> mutex_unlock(®ister_mutex);
> return err;
> --
> 2.15.0.531.g2ccb3012c9-goog
>
>
next prev parent reply other threads:[~2017-12-05 19:14 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-05 17:16 [PATCH] ALSA: pcm: prevent UAF in snd_pcm_info Nick Desaulniers
2017-12-05 17:19 ` Nick Desaulniers
2017-12-05 17:26 ` Greg KH
2017-12-05 19:14 ` Takashi Iwai [this message]
2017-12-05 19:29 ` Kees Cook
2017-12-05 22:30 ` 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=s5hvahldm28.wl-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=alsa-devel@alsa-project.org \
--cc=arvind.yadav.cs@gmail.com \
--cc=elfring@users.sourceforge.net \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ndesaulniers@google.com \
--cc=o-takashi@sakamocchi.jp \
--cc=perex@perex.cz \
--cc=rglasser@google.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