ALSA: pcm: prevent UAF in snd_pcm_info
authorRobb Glasser <rglasser@google.com>
Tue, 5 Dec 2017 17:16:55 +0000 (09:16 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 14 Dec 2017 08:52:54 +0000 (09:52 +0100)
commit0482dcd51004920b13b59995b7afb66df49937da
tree3592386ea45e7ae178dfba73496206eee038d6e3
parentc6705e4c64eb549c1eb86007438034dd7b7a6129
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>
sound/core/pcm.c