CVE-2026-90001
Severity CVSS v4.0:
Pending analysis
Type:
Unavailable / Other
Publication date:
16/09/2026
Last modified:
19/10/2026
Description
In the Linux kernel, the following vulnerability has been resolved:<br />
<br />
HID: bpf: serialize device reference release in struct_ops destroy path<br />
<br />
__hid_bpf_ops_destroy_device() and hid_bpf_unreg() can race on the<br />
same registration reference, double-putting struct hid_device and<br />
freeing it while hid_destroy_device() still uses it. Serialize the<br />
remove/NULL decision under hdev->bpf.prog_list_lock so exactly one<br />
path releases each registration reference: unreg re-checks ops->hdev<br />
under the lock and returns without putting when the destroy path<br />
already cleared it; all put_device() calls happen after the lock is<br />
dropped, which is safe because a concurrent unreg then observes<br />
ops->hdev == NULL under the lock.<br />
<br />
Background: each successful attach (hid_bpf_ops_reg) acquires one<br />
device reference (hid_get_device()). Two paths can release it:<br />
<br />
- device destruction: hid_destroy_device() -> hid_bpf_destroy_device()<br />
-> __hid_bpf_ops_destroy_device(), which walks hdev->bpf.prog_list<br />
under rcu_read_lock() and drops one reference per attached program;<br />
- BPF link release: bpf map delete (no BPF_F_LINK) synchronously calls<br />
st_ops->unreg() -> hid_bpf_unreg(), which drops the reference for<br />
its own registration.<br />
<br />
The coordination handshake (e->hdev = NULL on the destroy side vs<br />
"if (!hdev) return" on the unreg side) is a TOCTOU check: the two<br />
paths run under different lock domains (rcu_read_lock vs<br />
prog_list_lock), so a concurrent unreg can read ops->hdev as<br />
non-NULL, block on prog_list_lock, and then proceed while the<br />
destroy traversal executes - both paths then drop the same<br />
reference. The refcount reaches zero legitimately (each decrement<br />
is individually valid), so no refcount_t saturation fires: the<br />
device is simply freed while the transport is still inside<br />
hid_destroy_device(), and subsequent teardown touches freed memory.<br />
<br />
The fix serializes the remove/NULL decision under prog_list_lock on<br />
both sides and moves the destroy-side puts outside the lock. With<br />
the lock held, plain reads/writes of ops->hdev are sufficient; no<br />
READ_ONCE/WRITE_ONCE are added, keeping the patch minimal.<br />
<br />
Unlocked-read safety: the unlocked read of ops->hdev at the top of<br />
hid_bpf_unreg() cannot touch a freed device, because the unreg path<br />
itself still holds this registration&#39;s reference (released only by<br />
its own hid_put_device() after the lock is dropped), and a destroy<br />
traversal that already cleared ops->hdev makes the lock-internal<br />
re-check return early without any put. At most one of the two<br />
paths releases each registration reference.
Impact
Base Score 3.x
7.80
Severity 3.x
HIGH


