Skip to contentSkip to conversation

HID: alps: fix NULL pointer dereference in alps_raw_event()

PATCH Applied Greg Kroah-Hartman 2 participants 2 messages Apr 6 – Apr 9 HID

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 HID: alps: fix NULL pointer dereference in alps_raw_event()

Commit ecfa6f34492c ("HID: Add HID_CLAIMED_INPUT guards in raw_event callbacks missing them") attempted to fix up the HID drivers that had missed the previous fix that was done in 2ff5baa9b527 ("HID: appleir:
Fix potential NULL dereference at raw event handle"), but the alps driver was missed.

Fix this up by properly checking in the hid-alps driver that it had been claimed correctly before attempting to process the raw event.

Fixes 73196ebe134d ("HID: alps: add support for Alps T4 Touchpad device")
Cc stable <[email protected]>
Cc Jiri Kosina <[email protected]>
Cc Benjamin Tissoires <[email protected]>
Cc Masaki Ota <[email protected]>
Assisted-by gregkh_clanker_t1000
---
 drivers/hid/hid-alps.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/hid/hid-alps.c +3 -0
index 21e55f3d0d1b..67179e3fe39b 100644
@@ -437,6 +437,9 @@ static int alps_raw_event(struct hid_device *hdev,
 	int ret = 0;
 	struct alps_dev *hdata = hid_get_drvdata(hdev);
 
+	if (!(hdev->claimed & HID_CLAIMED_INPUT) || !hdata->input)
+		return 0;
+
 	switch (hdev->product) {
 	case HID_PRODUCT_ID_T4_BTNLESS:
 		ret = t4_raw_event(hdata, data, size);
Signature · 1 line
2.53.0
maintainer Applied
#1 lore raw
Quoted 9 lines · Greg Kroah-Hartman

Commit ecfa6f34492c ("HID: Add HID_CLAIMED_INPUT guards in raw_event callbacks missing them") attempted to fix up the HID drivers that had missed the previous fix that was done in 2ff5baa9b527 ("HID: appleir:
Fix potential NULL dereference at raw event handle"), but the alps driver was missed.

Fix this up by properly checking in the hid-alps driver that it had been claimed correctly before attempting to process the raw event.

Quoted 8 lines
Fixes 73196ebe134d ("HID: alps: add support for Alps T4 Touchpad device")
Cc stable <[email protected]>
Cc Jiri Kosina <[email protected]>
Cc Benjamin Tissoires <[email protected]>
Cc Masaki Ota <[email protected]>
Assisted-by gregkh_clanker_t1000

Applied, thanks.

Signature · 2 lines
Jiri Kosina
SUSE Labs