CVE-2025-38016: HID: bpf: abort dispatch if device destroyed

Published Jun 18, 2025
·
Updated

In the Linux kernel, the following vulnerability has been resolved:

HID: bpf: abort dispatch if device destroyed

The current HID bpf implementation assumes no output report/request will go through it after hidbpfdestroydevice() has been called. This leads to a bug that unplugging certain types of HID devices causes a cleaned- up SRCU to be accessed. The bug was previously a hidden failure until a recent x86 percpu change [1] made it access not-present pages.

The bug will be triggered if the conditions below are met:

A) a device under the driver has some LEDs on B) hidlldriver->request() is uninplemented (e.g., logitech-djreceiver)

If condition A is met, hidinputledworker() is always scheduled after hidbpfdestroydevice().

hiddestroydevice hidbpfdestroydevice cleanupsrcustruct(&hdev->bpf.srcu) hidremovedevice ... ledclassdevunregister ledtriggerset(ledcdev, NULL) ledsetbrightness(ledcdev, LEDOFF) ... inputinjectevent inputeventdispose hidinputinputevent schedulework(&hid->ledwork) [hidinputledworker]

This is fine when condition B is not met, where hidinputledworker() calls hidlldriver->request(). This is the case for most HID drivers, which implement it or use the generic one from usbhid. The driver itself or an underlying driver will then abort processing the request.

Otherwise, hidinputledworker() tries hidhwoutputreport() and leads to the bug.

hidinputledworker hidhwoutputreport dispatchhidbpfoutputreport srcureadlock(&hdev->bpf.srcu) srcureadunlock(&hdev->bpf.srcu, idx)

The bug has existed since the introduction [2] of dispatchhidbpfoutputreport(). However, the same bug also exists in dispatchhidbpfrawrequests(), and I've reproduced (no visible effect because of the lack of [1], but confirmed bpf.destroyed == 1) the bug against the commit (i.e., the Fixes:) introducing the function. This is because hidinputledworker() falls back to hidhwrawrequest() when hidlldriver->outputreport() is uninplemented (e.g., logitech- djreceiver).

hidinputledworker hidhwoutputreport: -ENOSYS hidhwrawrequest dispatchhidbpfrawrequests srcureadlock(&hdev->bpf.srcu) srcureadunlock(&hdev->bpf.srcu, idx)

Fix the issue by returning early in the two mentioned functions if hidbpf has been marked as destroyed. Though dispatchhidbpfdeviceevent() handles input events, and there is no evidence that it may be called after the destruction, the same check, as a safety net, is also added to it to maintain the consistency among all dispatch functions.

The impact of the bug on other architectures is unclear. Even if it acts as a hidden failure, this is still dangerous because it corrupts whatever is on the address calculated by SRCU. Thus, CC'ing the stable list.

[1]: commit 9d7de2aa8b41 ("x86/percpu/64: Use relative percpu offsets") [2]: commit 9286675a2aed ("HID: bpf: add HID-BPF hooks for hidhwoutputreport")

Affected Software

9 affected components
Linux Linux kernel
Linux Linux kernel>=6.11<6.12.30
Linux Linux kernel>=6.13<6.14.8
Linux Linux kernel=6.15-rc1
Linux Linux kernel=6.15-rc2
Linux Linux kernel=6.15-rc3
Linux Linux kernel=6.15-rc4
Linux Linux kernel=6.15-rc5
Linux Linux kernel=6.15-rc6

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Configuration

    Add/enable a safety check in HID-BPF so dispatch_hid_bpf_output_report() / dispatch_hid_bpf_raw_requests() abort dispatch when the HID device has been destroyed (described as “HID: bpf: abort dispatch if device destroyed”).

    Linux kernel HID-BPF abort dispatch if device destroyed = enabled
  2. Configuration

    In the two mentioned functions, fix the use-after-destroy bug by returning early when HID-BPF indicates the device has been destroyed (the material specifies “returning early in the two mentioned functions if … HID: bpf: abort dispatch if device destroyed”).

    Linux kernel HID-BPF return early in the two mentioned functions = return early
  3. Compensating control

    Ensure affected systems run kernels built with the referenced fix so that hidinput_led_worker() does not call hid_hw_output_report()/hid_hw_raw_request() after hid_bpf_destroy_device() has completed; otherwise schedule_work(&hid->led_work) may occur after destruction (per the provided call path).

Event History

Jun 18, 2025
CVE Published
via MITRE·09:28 AM
Data Sourced
via MITRE·09:28 AM
DescriptionSeverity
Data Sourced
via NVD·10:15 AM
RemedyDescriptionSeverityAffected Software

Frequently Asked Questions

1

What is the severity of CVE-2025-38016?

CVE-2025-38016 has been rated as a low-severity vulnerability in the Linux kernel.

2

How do I fix CVE-2025-38016?

To resolve CVE-2025-38016, upgrade to a patched version of the Linux kernel that addresses this vulnerability.

3

Which versions of Linux kernel are affected by CVE-2025-38016?

CVE-2025-38016 affects Linux kernel versions between 6.11 and 6.12.30, 6.13 to 6.14.8, and specific release candidate versions of 6.15.

4

What components are involved in CVE-2025-38016?

CVE-2025-38016 involves the Human Interface Device (HID) and its bpf implementation within the Linux kernel.

5

Is there a known exploit for CVE-2025-38016?

As of now, there are no known public exploits targeting CVE-2025-38016.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203