From: Jinmo Yang <jinmo44.yang@gmail.com>
To: Filipe Lains <lains@riseup.net>, 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: logitech-dj: shared receiver keeps unreferenced HID devices
Date: Sat, 28 Nov 2026 11:04:07 +0000 [thread overview]
Message-ID: <20261128110415.772810-5-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 with the standalone reproducer.
Kernel: mainline 7.2.0-ge46c86b19f4b (arm64, KASAN)
File: drivers/hid/hid-logitech-dj.c
Impact: use-after-free read and NULL/wild pointer dereferences
Repro: standalone C, approximately 57 seconds
## Report
BUG: KASAN: slab-use-after-free in __dev_printk
Read of size 8
dev_driver_string
__dev_printk
hid_err
logi_dj_recv_switch_to_dj_mode
logi_dj_probe
hid_device_probe
uhid_device_add_worker
The freed object was a struct hid_device allocated by uhid_dev_create2() and
released through hid_device_release() by a different task.
## Analysis
dj_receiver_dev is shared by interfaces whose phys paths have the same
prefix. It stores raw mouse, keyboard and hidpp hid_device pointers without
taking references. During concurrent probes, one interface can overwrite a
shared pointer that another interface later latches.
The reproduced order is:
1. receiver A begins probing;
2. receiver B overwrites the shared hidpp pointer;
3. A latches B's hdev and enters switch_to_dj_mode();
4. A's hid_hw_raw_request blocks waiting for uhid userspace;
5. B is destroyed and its hid_device is freed;
6. A's request returns and hid_err() dereferences B's freed hdev.
cancel_work_sync() in B's destruction does not help because the stale pointer
is held by A's worker. The existing remove path clears current back-pointers
under dj_hdev_list_lock, but that does not protect a pointer already latched
by another probe and held across the blocking raw request.
The shared pointer needs an object reference or exclusion that remains valid
for the complete operation, not only while finding or clearing the receiver
entry.
## 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-5-jinmo44.yang@gmail.com \
--to=jinmo44.yang@gmail.com \
--cc=bentiss@kernel.org \
--cc=jikos@kernel.org \
--cc=lains@riseup.net \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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