From: Zubin Mithra Date: Fri, 27 Aug 2021 15:37:35 +0000 (-0700) Subject: ALSA: pcm: fix divide error in snd_pcm_lib_ioctl X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=4a62351ee6ba07508a3b948bc30d5c9396930b77;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git ALSA: pcm: fix divide error in snd_pcm_lib_ioctl commit f3eef46f0518a2b32ca1244015820c35a22cfe4a upstream. Syzkaller reported a divide error in snd_pcm_lib_ioctl. fifo_size is of type snd_pcm_uframes_t(unsigned long). If frame_size is 0x100000000, the error occurs. Fixes: a9960e6a293e ("ALSA: pcm: fix fifo_size frame calculation") Signed-off-by: Zubin Mithra Reviewed-by: Guenter Roeck Cc: Link: https://lore.kernel.org/r/20210827153735.789452-1-zsm@chromium.org Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman --- diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c index c412f2a909c9..82a7387ba9d2 100644 --- a/sound/core/pcm_lib.c +++ b/sound/core/pcm_lib.c @@ -1757,7 +1757,7 @@ static int snd_pcm_lib_ioctl_fifo_size(struct snd_pcm_substream *substream, channels = params_channels(params); frame_size = snd_pcm_format_size(format, channels); if (frame_size > 0) - params->fifo_size /= (unsigned)frame_size; + params->fifo_size /= frame_size; } return 0; }