]> git.proxmox.com Git - mirror_ubuntu-focal-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)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Thu, 15 Jul 2021 17:27:07 +0000 (19:27 +0200)
commit0272647a239fd49709790321bd498df7ac62a587
tree133b931cdc9c3a7924b30809613c4a5bbbe7de8a
parent976752c0e16768449bfde29c231a86276e7ec492
HID: magicmouse: fix NULL-deref on disconnect

BugLink: https://bugs.launchpad.net/bugs/1932957
commit 4b4f6cecca446abcb686c6e6c451d4f1ec1a7497 upstream.

Commit 9d7b18668956 ("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: 9d7b18668956 ("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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kelsey Skunberg <kelsey.skunberg@canonical.com>
drivers/hid/hid-magicmouse.c