The source for the Linux kernel used in Windows Subsystem for Linux 2 (WSL2)
Перейти к файлу
Claudia Pellegrino a1091118e0 HID: magicmouse: prevent division by 0 on scroll
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>
2021-11-19 15:54:31 +01:00
Documentation Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid 2021-11-05 08:31:51 -07:00
LICENSES
arch Microblaze patches for 5.16-rc1 2021-11-05 08:19:56 -07:00
block
certs
crypto Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 2021-11-01 21:24:02 -07:00
drivers HID: magicmouse: prevent division by 0 on scroll 2021-11-19 15:54:31 +01:00
fs Driver core changes for 5.16-rc1 2021-11-04 08:32:38 -07:00
include HID: intel-ish-hid: fix module device-id handling 2021-11-11 22:45:40 +01:00
init Tracing updates for 5.16: 2021-11-01 20:05:19 -07:00
ipc
kernel IOMMU Updates for Linux v5.16: 2021-11-04 11:11:24 -07:00
lib Driver core changes for 5.16-rc1 2021-11-04 08:32:38 -07:00
mm Merge branch 'per_signal_struct_coredumps-for-v5.16' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace 2021-11-03 12:15:29 -07:00
net TTY / Serial driver update for 5.16-rc1 2021-11-04 09:09:37 -07:00
samples Char/Misc driver update for 5.16-rc1 2021-11-04 08:21:47 -07:00
scripts HID: intel-ish-hid: add support for MODULE_DEVICE_TABLE() 2021-11-09 11:41:46 +01:00
security integrity-v5.16 2021-11-02 10:51:28 -07:00
sound TTY / Serial driver update for 5.16-rc1 2021-11-04 09:09:37 -07:00
tools powerpc updates for 5.16 2021-11-05 08:15:46 -07:00
usr
virt
.clang-format
.cocciconfig
.get_maintainer.ignore
.gitattributes
.gitignore
.mailmap ARM: SoC DT updates for v5.16 2021-11-03 16:56:03 -07:00
COPYING
CREDITS
Kbuild
Kconfig
MAINTAINERS Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid 2021-11-05 08:31:51 -07:00
Makefile Devicetree updates for v5.16: 2021-11-02 22:22:13 -07:00
README

README

Linux kernel
============

There are several guides for kernel developers and users. These guides can
be rendered in a number of formats, like HTML and PDF. Please read
Documentation/admin-guide/README.rst first.

In order to build the documentation, use ``make htmldocs`` or
``make pdfdocs``.  The formatted documentation can also be read online at:

    https://www.kernel.org/doc/html/latest/

There are various text files in the Documentation/ subdirectory,
several of them using the Restructured Text markup notation.

Please read the Documentation/process/changes.rst file, as it contains the
requirements for building and running the kernel, and information about
the problems which may result by upgrading your kernel.