Re: [PATCH] HID: magicmouse: fix NULL-deref on disconnect

From: Jiri Kosina
Date: Wed May 26 2021 - 06:51:15 EST


On Mon, 17 May 2021, Johan Hovold wrote:

> 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@xxxxxxxxxxxxxxxxxxxxxxxxx
> Fixes: 9d7b18668956 ("HID: magicmouse: add support for Apple Magic Trackpad 2")
> Cc: stable@xxxxxxxxxxxxxxx # 4.20
> Cc: Claudio Mettler <claudio@xxxxxxxxxxxxxx>
> Cc: Marek Wyborski <marek.wyborski@xxxxxxxxxxxx>
> Cc: Sean O'Brien <seobrien@xxxxxxxxxxxx>
> Signed-off-by: Johan Hovold <johan@xxxxxxxxxx>

Applied, thanks Johan.

--
Jiri Kosina
SUSE Labs