lkml.org 
[lkml]   [2021]   [Nov]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] HID: magicmouse: prevent division by 0 on scroll
On Sun, 14 Nov 2021, Claudia Pellegrino wrote:

> In hid_magicmouse, if the user has set scroll_speed to a value between
> 55 and 63 and scrolls seven times in quick succession, the
> step_hr variable in the magicmouse_emit_touch function becomes 0.
>
> That causes a division by zero further down in the function when
> it does `step_x_hr /= step_hr`.
>
> To reproduce, create `/etc/modprobe.d/hid_magicmouse.conf` with the
> following content:
>
> ```
> options hid_magicmouse scroll_acceleration=1 scroll_speed=55
> ```
>
> Then reboot, connect a Magic Mouse and scroll seven times quickly.
> The system will freeze for a minute, and after that `dmesg` will
> confirm that a division by zero occurred.
>
> Enforce a minimum of 1 for the variable so the high resolution
> step count can never reach 0 even at maximum scroll acceleration.
>
> Fixes: d4b9f10a0eb6 ("HID: magicmouse: enable high-resolution scroll")
>
> Signed-off-by: Claudia Pellegrino <linux@cpellegrino.de>

Applied, thank you.

--
Jiri Kosina
SUSE Labs

\
 
 \ /
  Last update: 2021-11-19 15:55    [W:0.061 / U:0.308 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site