]> git.baikalelectronics.ru Git - kernel.git/commit
HID: magicmouse: fix NULL-deref on disconnect
authorJohan Hovold <johan@kernel.org>
Mon, 17 May 2021 10:04:30 +0000 (12:04 +0200)
committerJiri Kosina <jkosina@suse.cz>
Thu, 27 May 2021 13:40:35 +0000 (15:40 +0200)
commitd3092fd8c35d3f23dfd27fde5376127ce065abc1
tree43e7527141c338325a6c31c2fbfcaa0e8f34e066
parent7860bb7fc70a736713f75a9515823f4a6e5fab5b
HID: magicmouse: fix NULL-deref on disconnect

Commit ff6a5317a35b ("HID: magicmouse: add support for Apple Magic
Trackpad 2") added a sanity check for an Apple trackpad but returned
success instead of -ENODEV when the check failed. This means that the
remove callback will dereference the never-initialised driver data
pointer when the driver is later unbound (e.g. on USB disconnect).

Reported-by: syzbot+ee6f6e2e68886ca256a8@syzkaller.appspotmail.com
Fixes: ff6a5317a35b ("HID: magicmouse: add support for Apple Magic Trackpad 2")
Cc: stable@vger.kernel.org # 4.20
Cc: Claudio Mettler <claudio@ponyfleisch.ch>
Cc: Marek Wyborski <marek.wyborski@emwesoft.com>
Cc: Sean O'Brien <seobrien@chromium.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/hid-magicmouse.c