Linux Input/HID development
 help / color / mirror / Atom feed
* HID: wacom: LED callbacks race with led.groups teardown
@ 2026-11-28 11:04 Jinmo Yang
  0 siblings, 0 replies; only message in thread
From: Jinmo Yang @ 2026-11-28 11:04 UTC (permalink / raw)
  To: Ping Cheng, Jason Gerecke, Jiri Kosina, Benjamin Tissoires
  Cc: Jinmo Yang, linux-input, linux-kernel

Found by coverage-guided fuzzing of the HID subsystem through /dev/uhid.
No patch is attached; I am reporting the lifetime issue first and can test
candidate fixes against the existing KASAN setup.

Kernel: mainline 7.2.0-g66498c75b4f8 (arm64, KASAN)
File:   drivers/hid/wacom_sys.c
Impact: NULL pointer dereference; denial of service
Repro:  syzkaller; independently reproduced with linux-next Wacom sources

## Report

  Unable to handle kernel paging request at virtual address dfff800000000000
  KASAN: null-ptr-deref in range [0x0-0x7]
  Workqueue: leds set_brightness_delayed
   wacom_led_control
   wacom_led_brightness_set
   __led_set_brightness_blocking
   set_brightness_delayed_set_brightness
   set_brightness_delayed

The same fault reproduced after replacing the Wacom sources with the
linux-next versions; only line numbers changed.

## Analysis

wacom_led_control() checks the shared pointer and uses it later:

  if (!wacom->led.groups)
          return -ENOTSUPP;
  ...
  int led = wacom->led.groups[0].select | 0x4;

The devres teardown action can clear it between those operations:

  static void wacom_led_groups_release(void *data)
  {
          struct wacom *wacom = data;

          wacom->led.groups = NULL;
          wacom->led.count = 0;
  }

The reader is an LED-core work item and teardown does not take the lock used
by several LED callbacks.  Consequently neither the initial NULL check nor
the callback-side mutex keeps the array alive.  Other callbacks also access
the same state, including __wacom_led_brightness_get() and the sysfs show
and store methods, some without a NULL check.

This is the same lifetime pattern as the Wacom battery race, but it involves
a separate resource, teardown action, and callback family.  Rechecking or
reordering a pointer assignment does not close the load/use race; teardown
must be serialized with all LED callbacks that use the array.

## Upstream status

Rechecked against mainline, linux-next, HID maintainer branches, and lore
through 2026-11-28.  The defect remains unpatched and I found no matching
submission.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-28 11:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-28 11:04 HID: wacom: LED callbacks race with led.groups teardown Jinmo Yang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox