summaryrefslogtreecommitdiffstats
path: root/sound/core
diff options
context:
space:
mode:
authorRobb Glasser <rglasser@google.com>2017-12-05 09:16:55 -0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-12-16 10:33:48 +0100
commit659e7d2588f0fd970044fe00d9edeb482d375288 (patch)
treeef506327bd44b88ff54fa98e31aa13b8b13678f2 /sound/core
parent5986c9685f1e53c20e6a5ddd9f39020d8634fc62 (diff)
downloadlinux-stable-659e7d2588f0fd970044fe00d9edeb482d375288.tar.gz
linux-stable-659e7d2588f0fd970044fe00d9edeb482d375288.tar.bz2
linux-stable-659e7d2588f0fd970044fe00d9edeb482d375288.zip
ALSA: pcm: prevent UAF in snd_pcm_info
commit 362bca57f5d78220f8b5907b875961af9436e229 upstream. 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`. Note: this fixes CVE-2017-0861 Signed-off-by: Robb Glasser <rglasser@google.com> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'sound/core')
-rw-r--r--sound/core/pcm.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sound/core/pcm.c b/sound/core/pcm.c
index 8e980aa678d0..074363b63cc4 100644
--- a/sound/core/pcm.c
+++ b/sound/core/pcm.c
@@ -149,7 +149,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(&register_mutex);
return err;