Claudia Pellegrino
25bbaa3ae1
HID: magicmouse: prevent division by 0 on scroll
...
[ Upstream commit a1091118e0d6d84c2fdb94e6c397ac790bfb9dd6 ]
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: d4b9f10a0e ("HID: magicmouse: enable high-resolution scroll")
Signed-off-by: Claudia Pellegrino <linux@cpellegrino.de >
Tested-by: José Expósito <jose.exposito89@gmail.com >
Signed-off-by: Jiri Kosina <jkosina@suse.cz >
Signed-off-by: Sasha Levin <sashal@kernel.org >
2021-12-01 09:04:48 +01:00
..
2021-09-27 10:00:43 +02:00
2021-09-01 22:01:27 +02:00
2021-08-09 09:03:47 +02:00
2021-11-18 19:15:59 +01:00
2021-09-01 22:00:06 +02:00
2021-05-05 14:29:13 +02:00
2019-05-30 11:26:32 -07:00
2021-04-29 21:47:22 +02:00
2021-09-15 16:44:10 +02:00
2020-03-13 17:33:11 +01:00
2021-08-20 14:50:41 +02:00
2019-05-21 10:50:45 +02:00
2019-10-03 15:36:40 -04:00
2019-05-30 11:26:32 -07:00
2021-09-15 16:31:21 +02:00
2020-02-18 14:43:51 +01:00
2019-05-30 11:26:32 -07:00
2021-01-14 13:13:24 +01:00
2021-07-28 11:51:07 +02:00
2021-07-21 11:53:42 +02:00
2019-05-30 11:26:32 -07:00
2020-08-17 11:38:49 +02:00
2021-03-08 14:55:31 +01:00
2019-09-03 16:52:04 +02:00
2020-10-23 13:23:44 +02:00
2021-06-30 09:03:51 +02:00
2019-10-03 15:36:40 -04:00
2021-04-07 12:46:33 +02:00
2020-11-25 17:40:23 +01:00
2021-08-20 14:22:28 +02:00
2019-10-03 15:36:40 -04:00
2019-05-30 11:26:32 -07:00
2021-07-29 12:38:32 +02:00
2019-10-03 15:36:40 -04:00
2019-05-30 11:26:32 -07:00
2019-05-30 11:26:32 -07:00
2019-08-22 17:11:58 +02:00
2020-03-18 13:36:21 +01:00
2021-05-05 14:34:41 +02:00
2021-05-27 15:40:34 +02:00
2019-05-30 11:26:32 -07:00
2019-08-05 14:18:42 +02:00
2019-05-30 11:26:32 -07:00
2019-10-03 15:36:40 -04:00
2020-09-28 08:57:28 +00:00
2019-05-30 11:26:32 -07:00
2021-11-25 09:48:27 +01:00
2021-12-01 09:04:48 +01:00
2021-05-05 14:39:24 +02:00
2019-05-30 11:26:32 -07:00
2019-05-30 11:26:32 -07:00
2019-05-30 11:26:32 -07:00
2021-04-07 18:46:20 +02:00
2019-05-30 11:26:32 -07:00
2019-06-05 17:37:10 +02:00
2021-04-07 12:48:20 +02:00
2019-10-03 15:36:40 -04:00
2019-10-03 15:36:40 -04:00
2019-10-03 15:36:40 -04:00
2021-05-05 14:39:24 +02:00
2021-03-08 11:05:50 +01:00
2019-10-03 15:36:40 -04:00
2021-06-30 09:15:15 +02:00
2021-08-20 14:32:39 +02:00
2020-08-17 11:38:49 +02:00
2021-12-01 09:04:48 +01:00
2019-01-14 20:11:01 +01:00
2020-11-05 11:16:53 +01:00
2020-11-25 14:30:33 +01:00
2020-09-02 12:55:46 -07:00
2019-05-30 11:26:32 -07:00
2021-11-25 09:48:27 +01:00
2019-05-30 11:26:32 -07:00
2019-05-30 11:26:32 -07:00
2019-05-30 11:26:32 -07:00
2019-05-30 11:26:32 -07:00
2019-05-30 11:26:32 -07:00
2019-06-05 17:30:28 +02:00
2020-09-03 16:18:55 +02:00
2021-04-07 18:46:20 +02:00
2019-06-05 17:30:28 +02:00
2020-04-01 12:26:12 +02:00
2019-06-05 17:30:28 +02:00
2019-06-05 17:30:28 +02:00
2019-06-05 17:30:28 +02:00
2019-05-30 11:26:35 -07:00
2021-03-08 11:08:58 +01:00
2021-02-18 17:41:51 +01:00
2019-06-05 17:36:37 +02:00
2019-10-01 16:21:04 +02:00
2021-08-20 14:53:54 +02:00
2018-06-25 15:23:40 +02:00
2019-05-30 11:26:32 -07:00
2020-10-23 16:16:31 -07:00
2021-02-05 10:16:45 +01:00
2019-05-30 11:26:32 -07:00
2019-05-30 11:26:32 -07:00
2019-05-30 11:26:32 -07:00
2019-05-30 11:26:32 -07:00
2019-05-30 11:26:32 -07:00
2020-10-15 20:41:43 +02:00
2019-05-30 11:26:32 -07:00
2019-05-30 11:26:32 -07:00
2019-05-30 11:26:32 -07:00
2019-05-30 11:26:32 -07:00
2019-05-30 11:26:32 -07:00
2019-05-30 11:26:32 -07:00
2019-05-30 11:26:32 -07:00
2019-05-30 11:26:32 -07:00
2019-05-30 11:26:32 -07:00
2019-05-30 11:26:32 -07:00
2019-05-30 11:26:32 -07:00
2019-05-30 11:26:32 -07:00
2019-05-30 11:26:32 -07:00
2019-05-30 11:26:32 -07:00
2019-05-30 11:26:32 -07:00
2019-05-30 11:26:32 -07:00
2021-05-05 14:21:08 +02:00
2021-05-26 12:36:46 +02:00
2021-05-05 14:36:18 +02:00
2019-05-30 11:26:35 -07:00
2021-09-01 22:03:18 +02:00
2019-05-30 11:26:32 -07:00
2020-06-19 09:21:21 +02:00
2019-05-30 11:26:32 -07:00
2019-05-30 11:26:32 -07:00
2021-08-20 14:24:57 +02:00
2019-05-30 11:26:32 -07:00
2019-10-03 15:36:40 -04:00
2019-05-30 11:26:32 -07:00
2019-05-30 11:29:19 -07:00
2021-11-18 19:16:56 +01:00
2021-01-08 14:05:48 +01:00
2021-04-07 18:46:20 +02:00
2019-02-21 12:00:54 +01:00
2021-04-07 18:46:20 +02:00
2019-02-21 12:00:54 +01:00
2020-07-20 12:24:41 +02:00
2019-02-21 12:00:53 +01:00
2020-09-30 22:44:26 +02:00
2019-05-30 11:26:32 -07:00
2021-01-07 10:14:58 +01:00
2019-05-30 11:26:32 -07:00
2020-06-19 14:17:22 +02:00
2020-06-19 14:17:22 +02:00
2019-05-30 11:26:32 -07:00
2019-10-03 15:36:40 -04:00
2019-05-30 11:26:32 -07:00
2020-11-27 15:48:31 +01:00
2021-09-01 22:03:18 +02:00
2021-08-20 14:53:54 +02:00
2020-01-10 15:34:28 +01:00
2021-07-28 11:45:40 +02:00
2021-12-01 09:04:41 +01:00
2021-12-01 09:04:41 +01:00
2019-11-06 21:37:29 +01:00