ALSA: pcm: Fix UAF in snd_pcm_oss_get_formats()
authorTakashi Iwai <tiwai@suse.de>
Sat, 10 Mar 2018 22:04:23 +0000 (23:04 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 21 Mar 2018 11:06:42 +0000 (12:06 +0100)
commit5ee6abaa537059cc448b5d0344a0c400c2c23d7e
treed781f4a321a51c5a7b44cd98849fcb0bf20e085d
parenta9cf8b6fe73bc86039b67057f1f175fa24dccdf6
ALSA: pcm: Fix UAF in snd_pcm_oss_get_formats()

commit 01c0b4265cc16bc1f43f475c5944c55c10d5768f upstream.

snd_pcm_oss_get_formats() has an obvious use-after-free around
snd_mask_test() calls, as spotted by syzbot.  The passed format_mask
argument is a pointer to the hw_params object that is freed before the
loop.  What a surprise that it has been present since the original
code of decades ago...

Reported-by: syzbot+4090700a4f13fccaf648@syzkaller.appspotmail.com
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
sound/core/oss/pcm_oss.c