Skip to content

Commit 1a1ebdc

Browse files
testacegigregkh
authored andcommitted
HID: wacom: stop hardware after post-start probe failures
commit ec2612b upstream. wacom_parse_and_register() starts HID hardware before registering inputs and initializing pad LEDs/remotes. Those later steps can fail, but their error paths currently release Wacom resources without stopping the HID hardware. Route post-hid_hw_start() failures through hid_hw_stop() before releasing driver resources. This issue was identified during our ongoing static-analysis research while reviewing kernel code. Fixes: c1d6708 ("HID: wacom: Do not register input devices until after hid_hw_start") Cc: stable@vger.kernel.org Co-developed-by: Ijae Kim <ae878000@gmail.com> Signed-off-by: Ijae Kim <ae878000@gmail.com> Signed-off-by: Myeonghun Pak <mhun512@gmail.com> Reviewed-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 5b535bd commit 1a1ebdc

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

drivers/hid/wacom_sys.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2422,16 +2422,16 @@ static int wacom_parse_and_register(struct wacom *wacom, bool wireless)
24222422

24232423
error = wacom_register_inputs(wacom);
24242424
if (error)
2425-
goto fail;
2425+
goto fail_hw_stop;
24262426

24272427
if (wacom->wacom_wac.features.device_type & WACOM_DEVICETYPE_PAD) {
24282428
error = wacom_initialize_leds(wacom);
24292429
if (error)
2430-
goto fail;
2430+
goto fail_hw_stop;
24312431

24322432
error = wacom_initialize_remotes(wacom);
24332433
if (error)
2434-
goto fail;
2434+
goto fail_hw_stop;
24352435
}
24362436

24372437
if (!wireless) {
@@ -2445,14 +2445,14 @@ static int wacom_parse_and_register(struct wacom *wacom, bool wireless)
24452445
cancel_delayed_work_sync(&wacom->init_work);
24462446
_wacom_query_tablet_data(wacom);
24472447
error = -ENODEV;
2448-
goto fail_quirks;
2448+
goto fail_hw_stop;
24492449
}
24502450

24512451
if (features->device_type & WACOM_DEVICETYPE_WL_MONITOR) {
24522452
error = hid_hw_open(hdev);
24532453
if (error) {
24542454
hid_err(hdev, "hw open failed\n");
2455-
goto fail_quirks;
2455+
goto fail_hw_stop;
24562456
}
24572457
}
24582458

@@ -2461,7 +2461,7 @@ static int wacom_parse_and_register(struct wacom *wacom, bool wireless)
24612461

24622462
return 0;
24632463

2464-
fail_quirks:
2464+
fail_hw_stop:
24652465
hid_hw_stop(hdev);
24662466
fail:
24672467
wacom_release_resources(wacom);

0 commit comments

Comments
 (0)