ALSA: pcm: oss: Fix potential out-of-bounds shift
authorTakashi Iwai <tiwai@suse.de>
Wed, 9 Dec 2020 08:45:52 +0000 (09:45 +0100)
committerTakashi Iwai <tiwai@suse.de>
Mon, 14 Dec 2020 08:10:39 +0000 (09:10 +0100)
commit175b8d89fe292796811fdee87fa39799a5b6b87a
tree2188693002fdf3c7e765d78be8a83b8c289f35c4
parent43d5ca88dfcd35e43010fdd818e067aa9a55f5ba
ALSA: pcm: oss: Fix potential out-of-bounds shift

syzbot spotted a potential out-of-bounds shift in the PCM OSS layer
where it calculates the buffer size with the arbitrary shift value
given via an ioctl.

Add a range check for avoiding the undefined behavior.
As the value can be treated by a signed integer, the max shift should
be 30.

Reported-by: syzbot+df7dc146ebdd6435eea3@syzkaller.appspotmail.com
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20201209084552.17109-2-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/core/oss/pcm_oss.c