Skip to contentSkip to conversation

HID: wacom: NULL dereferences on error in probe()

PATCH Applied Dan Carpenter 3 participants 3 messages Jun 24, 2015 – Jun 26, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 HID: wacom: NULL dereferences on error in probe()

We can't pass a NULL to input_unregister_device().

Fixes 2a6cdbdd4cc0 ('HID: wacom: Introduce new 'touch_input' device')
drivers/hid/wacom_sys.c +4 -2
index 4c0ffca..44958d7 100644
@@ -1271,11 +1271,13 @@ fail_leds:
 	pad_input_dev = NULL;
 	wacom_wac->pad_registered = false;
 fail_register_pad_input:
-	input_unregister_device(touch_input_dev);
+	if (touch_input_dev)
+		input_unregister_device(touch_input_dev);
 	wacom_wac->touch_input = NULL;
 	wacom_wac->touch_registered = false;
 fail_register_touch_input:
-	input_unregister_device(pen_input_dev);
+	if (pen_input_dev)
+		input_unregister_device(pen_input_dev);
 	wacom_wac->pen_input = NULL;
 	wacom_wac->pen_registered = false;
 fail_register_pen_input:
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Dan Carpenter

We can't pass a NULL to input_unregister_device().

Fixes 2a6cdbdd4cc0 ('HID: wacom: Introduce new 'touch_input' device')

Looks reasonable to me.

Signature · 7 lines
Jason
---
Now instead of four in the eights place /
you’ve got three, ‘Cause you added one /
(That is to say, eight) to the two, /
But you can’t take seven from three, /
So you look at the sixty-fours....
Quoted 21 lines
drivers/hid/wacom_sys.c +4 -3
index 4c0ffca..44958d7 100644
@@ -1271,11 +1271,13 @@ fail_leds:
 	pad_input_dev = NULL;
 	wacom_wac->pad_registered = false;
 fail_register_pad_input:
-	input_unregister_device(touch_input_dev);
+	if (touch_input_dev)
+		input_unregister_device(touch_input_dev);
 	wacom_wac->touch_input = NULL;
 	wacom_wac->touch_registered = false;
 fail_register_touch_input:
-	input_unregister_device(pen_input_dev);
+	if (pen_input_dev)
+		input_unregister_device(pen_input_dev);
 	wacom_wac->pen_input = NULL;
 	wacom_wac->pen_registered = false;
 fail_register_pen_input:
--
Quoted 4 lines

To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html