* [PATCH v2] ALSA: pcm: fix divide error in snd_pcm_lib_ioctl
@ 2021-08-27 15:37 Zubin Mithra
2021-08-27 16:34 ` Guenter Roeck
2021-08-27 20:34 ` Takashi Iwai
0 siblings, 2 replies; 3+ messages in thread
From: Zubin Mithra @ 2021-08-27 15:37 UTC (permalink / raw)
To: alsa-devel; +Cc: groeck, tiwai, Zubin Mithra
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 <zsm@chromium.org>
---
sound/core/pcm_lib.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c
index 7d5883432085..a144a3f68e9e 100644
--- a/sound/core/pcm_lib.c
+++ b/sound/core/pcm_lib.c
@@ -1746,7 +1746,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;
}
--
2.33.0.259.gc128427fd7-goog
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] ALSA: pcm: fix divide error in snd_pcm_lib_ioctl
2021-08-27 15:37 [PATCH v2] ALSA: pcm: fix divide error in snd_pcm_lib_ioctl Zubin Mithra
@ 2021-08-27 16:34 ` Guenter Roeck
2021-08-27 20:34 ` Takashi Iwai
1 sibling, 0 replies; 3+ messages in thread
From: Guenter Roeck @ 2021-08-27 16:34 UTC (permalink / raw)
To: Zubin Mithra; +Cc: Guenter Roeck, ALSA development, Takashi Iwai
On Fri, Aug 27, 2021 at 8:37 AM Zubin Mithra <zsm@chromium.org> wrote:
>
> 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")
Reviewed-by: Guenter Roeck <groeck@chromium.org>
> Signed-off-by: Zubin Mithra <zsm@chromium.org>
> ---
> sound/core/pcm_lib.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c
> index 7d5883432085..a144a3f68e9e 100644
> --- a/sound/core/pcm_lib.c
> +++ b/sound/core/pcm_lib.c
> @@ -1746,7 +1746,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;
> }
> --
> 2.33.0.259.gc128427fd7-goog
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] ALSA: pcm: fix divide error in snd_pcm_lib_ioctl
2021-08-27 15:37 [PATCH v2] ALSA: pcm: fix divide error in snd_pcm_lib_ioctl Zubin Mithra
2021-08-27 16:34 ` Guenter Roeck
@ 2021-08-27 20:34 ` Takashi Iwai
1 sibling, 0 replies; 3+ messages in thread
From: Takashi Iwai @ 2021-08-27 20:34 UTC (permalink / raw)
To: Zubin Mithra; +Cc: groeck, alsa-devel, tiwai
On Fri, 27 Aug 2021 17:37:35 +0200,
Zubin Mithra wrote:
>
> 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 <zsm@chromium.org>
Thanks, applied.
Takashi
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-08-27 20:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-27 15:37 [PATCH v2] ALSA: pcm: fix divide error in snd_pcm_lib_ioctl Zubin Mithra
2021-08-27 16:34 ` Guenter Roeck
2021-08-27 20:34 ` Takashi Iwai
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.