[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210608175949.118331682@linuxfoundation.org>
Date: Tue, 8 Jun 2021 20:27:18 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org,
syzbot+ee6f6e2e68886ca256a8@...kaller.appspotmail.com,
Claudio Mettler <claudio@...yfleisch.ch>,
Marek Wyborski <marek.wyborski@...esoft.com>,
Sean OBrien <seobrien@...omium.org>,
Johan Hovold <johan@...nel.org>, Jiri Kosina <jkosina@...e.cz>
Subject: [PATCH 5.12 108/161] HID: magicmouse: fix NULL-deref on disconnect
From: Johan Hovold <johan@...nel.org>
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@...kaller.appspotmail.com
Fixes: 9d7b18668956 ("HID: magicmouse: add support for Apple Magic Trackpad 2")
Cc: stable@...r.kernel.org # 4.20
Cc: Claudio Mettler <claudio@...yfleisch.ch>
Cc: Marek Wyborski <marek.wyborski@...esoft.com>
Cc: Sean O'Brien <seobrien@...omium.org>
Signed-off-by: Johan Hovold <johan@...nel.org>
Signed-off-by: Jiri Kosina <jkosina@...e.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
drivers/hid/hid-magicmouse.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/drivers/hid/hid-magicmouse.c
+++ b/drivers/hid/hid-magicmouse.c
@@ -597,7 +597,7 @@ static int magicmouse_probe(struct hid_d
if (id->vendor == USB_VENDOR_ID_APPLE &&
id->product == USB_DEVICE_ID_APPLE_MAGICTRACKPAD2 &&
hdev->type != HID_TYPE_USBMOUSE)
- return 0;
+ return -ENODEV;
msc = devm_kzalloc(&hdev->dev, sizeof(*msc), GFP_KERNEL);
if (msc == NULL) {
Powered by blists - more mailing lists