diff mbox

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

Message ID 20150624142743.GA1702@mwanda (mailing list archive)
State New, archived
Delegated to: Jiri Kosina
Headers show

Commit Message

Dan Carpenter June 24, 2015, 2:27 p.m. UTC
We can't pass a NULL to input_unregister_device().

Fixes: 2a6cdbdd4cc0 ('HID: wacom: Introduce new 'touch_input' device')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

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

Comments

Gerecke, Jason June 25, 2015, 8:59 p.m. UTC | #1
On 6/24/2015 7:27 AM, Dan Carpenter wrote:
> We can't pass a NULL to input_unregister_device().
> 
> Fixes: 2a6cdbdd4cc0 ('HID: wacom: Introduce new 'touch_input' device')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 

Looks reasonable to me.
Reviewed-by: Jason Gerecke <jason.gerecke@wacom.com>
Jiri Kosina June 26, 2015, 12:08 p.m. UTC | #2
On Thu, 25 Jun 2015, Jason Gerecke wrote:

> > Fixes: 2a6cdbdd4cc0 ('HID: wacom: Introduce new 'touch_input' device')
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> Looks reasonable to me.
> Reviewed-by: Jason Gerecke <jason.gerecke@wacom.com>

Applied to for-4.2/upstream-fixes. Thanks,
diff mbox

Patch

diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c
index 4c0ffca..44958d7 100644
--- a/drivers/hid/wacom_sys.c
+++ b/drivers/hid/wacom_sys.c
@@ -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: