Linux Input/HID development
 help / color / mirror / Atom feed
From: Jinmo Yang <jinmo44.yang@gmail.com>
To: Ping Cheng <ping.cheng@wacom.com>,
	Jason Gerecke <jason.gerecke@wacom.com>,
	Jiri Kosina <jikos@kernel.org>,
	Benjamin Tissoires <bentiss@kernel.org>
Cc: Jinmo Yang <jinmo44.yang@gmail.com>,
	linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: HID: wacom: LED callbacks race with led.groups teardown
Date: Sat, 28 Nov 2026 11:04:05 +0000	[thread overview]
Message-ID: <20261128110415.772810-3-jinmo44.yang@gmail.com> (raw)

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.

                 reply	other threads:[~2026-11-28 11:06 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261128110415.772810-3-jinmo44.yang@gmail.com \
    --to=jinmo44.yang@gmail.com \
    --cc=bentiss@kernel.org \
    --cc=jason.gerecke@wacom.com \
    --cc=jikos@kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ping.cheng@wacom.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox