]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
HID: magicmouse: fix crash when disconnecting Magic Trackpad 2
authorJosé Expósito <jose.exposito89@gmail.com>
Mon, 10 May 2021 06:22:37 +0000 (08:22 +0200)
committerJiri Kosina <jkosina@suse.cz>
Thu, 27 May 2021 13:40:34 +0000 (15:40 +0200)
commit4fb125192563670e820991de48f8db495ecc7ff7
tree9cbbc7634c0e5873205328fb529938b4b7a94af0
parenta4b494099ad657f1cb85436d333cf38870ee95bc
HID: magicmouse: fix crash when disconnecting Magic Trackpad 2

When the Apple Magic Trackpad 2 is connected over USB it registers four
hid_device report descriptors, however, the driver only handles the one
with type HID_TYPE_USBMOUSE and ignores the other three, thus, no driver
data is attached to them.

When the device is disconnected, the remove callback is called for the
four hid_device report descriptors, crashing when the driver data is
NULL.

Check that the driver data is not NULL before using it in the remove
callback.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/hid-magicmouse.c