CVE-2026-138844

usb: core: don't set drvdata to NULL in usb_unbind_interface()

Published Nov 30, 2026 CVSS n/a EPSS n/a KEV · Not listed
Description
In the Linux kernel, the following vulnerability has been resolved:

usb: core: don't set drvdata to NULL in usb_unbind_interface()

usb_unbind_interface() serves as the remove() callback of struct
usb_driver and calls usb_set_intfdata(intf, NULL) to clear the bus
device private data pointer.

However, the driver core code already sets the bus device private data
pointer to NULL in device_unbind_cleanup() *after* devres_release_all(),
which makes the call redundant.

In addition, it can create unexpected NULL pointer dereference scenarios
when drivers use managed APIs.

int probe(struct usb_interface *intf,
const struct usb_device_id *id)
{
struct data *data;
int ret;

data = devm_kzalloc(&intf->dev, sizeof(*data), GFP_KERNEL);
if (!data)
return -ENOMEM;

ret = devm_device_add_group(&intf->dev, &foo_attr_group);
if (ret)
return ret;

...
}

ssize_t foo_value_show(struct device *dev, struct device_attribute *attr,
char *buf)
{
struct usb_interface *intf = to_usb_interface(dev);
struct data *data = usb_get_intfdata(intf);

/* Potential NULL pointer dereference */
return sysfs_emit(buf, "%u\n", data->value);
}

Nothing prevents usb_unbind_interface() to race with foo_value_show()
and set usb_set_intfdata(intf, NULL).

The same applies to the unwind path of usb_probe_interface(), which also
calls usb_set_intfdata(intf, NULL).

Besides that, the Rust driver core code manages a driver's bus device
private data and destroys it in device_unbind_cleanup().

If usb_unbind_interface() sets the pointer to NULL prematurely, the Rust
driver core code sees NULL, and hence skips the destructor of the bus
device private data, which leaks all its resources.

Thus, drop usb_set_intfdata(intf, NULL) from usb_probe_interface() and
usb_unbind_interface(), and move it to usb_driver_release_interface(),
which manually calls the remove() callback of struct usb_driver and
hence can't rely on the driver core.

Analysis

AI-generated

Technical impact

A Linux kernel defect causes the usb_unbind_interface() and usb_probe_interface() functions to clear the USB driver private data pointer while other code paths may still access it. The driver core already clears this pointer during device_unbind_cleanup, making the clear operation redundant. For drivers that use managed APIs, an asynchronous race can result in usb_get_intfdata() returning NULL, which leads to a NULL pointer dereference in the driver. Rust kernel code that depends on the bus device private data may also see the pointer cleared prematurely and skip necessary cleanup, leaking resources. The result is a kernel Oops or crash, which can provide a local privilege escalation path for a malicious USB driver or device.

Affected Systems

Any Linux system running the affected kernel code, regardless of distribution, that uses the standard USB subsystem. The exact kernel versions are not specified, but the issue exists in the code path handled by the referenced Git commits and before the downstream patches are applied.

Risk and Exploitability

The CVSS score is not provided in the data, and there is no EPSS score available. The vulnerability can be exploited locally by a user who can load a malicious USB driver or supply a specially crafted USB device, potentially causing a kernel crash and privilege escalation. No public exploit is currently listed in the CISA KEV catalog, and the exploitation probability appears low from the available data, but the impact of a kernel crash is severe, so the overall risk is moderate to high for systems with open USB interfaces.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Apply the kernel patch that removes usb_set_intfdata(intf, NULL) from usb_probe_interface() and usb_unbind_interface(), and moves it to usb_driver_release_interface()
  • Upgrade to a newer Linux kernel version that incorporates this fix
  • If a kernel upgrade cannot be performed immediately, reduce risk by disabling unused USB ports, restricting USB device access to privileged users, or employing device lockdown mechanisms to prevent malicious USB drivers from loading

Generated by OpenCVE AI on November 30, 2026 at 17:17 UTC.

Tracking

Sign in to view the affected projects.

Exploits

Explore public exploit intelligence with OpenCVE Pro.

Advisories

No advisories available
History
Type Values Removed Values Added
Weaknesses CWE-476
CWE-690
Type Values Removed Values Added
Description In the Linux kernel, the following vulnerability has been resolved: usb: core: don't set drvdata to NULL in usb_unbind_interface() usb_unbind_interface() serves as the remove() callback of struct usb_driver and calls usb_set_intfdata(intf, NULL) to clear the bus device private data pointer. However, the driver core code already sets the bus device private data pointer to NULL in device_unbind_cleanup() *after* devres_release_all(), which makes the call redundant. In addition, it can create unexpected NULL pointer dereference scenarios when drivers use managed APIs. int probe(struct usb_interface *intf, const struct usb_device_id *id) { struct data *data; int ret; data = devm_kzalloc(&intf->dev, sizeof(*data), GFP_KERNEL); if (!data) return -ENOMEM; ret = devm_device_add_group(&intf->dev, &foo_attr_group); if (ret) return ret; ... } ssize_t foo_value_show(struct device *dev, struct device_attribute *attr, char *buf) { struct usb_interface *intf = to_usb_interface(dev); struct data *data = usb_get_intfdata(intf); /* Potential NULL pointer dereference */ return sysfs_emit(buf, "%u\n", data->value); } Nothing prevents usb_unbind_interface() to race with foo_value_show() and set usb_set_intfdata(intf, NULL). The same applies to the unwind path of usb_probe_interface(), which also calls usb_set_intfdata(intf, NULL). Besides that, the Rust driver core code manages a driver's bus device private data and destroys it in device_unbind_cleanup(). If usb_unbind_interface() sets the pointer to NULL prematurely, the Rust driver core code sees NULL, and hence skips the destructor of the bus device private data, which leaks all its resources. Thus, drop usb_set_intfdata(intf, NULL) from usb_probe_interface() and usb_unbind_interface(), and move it to usb_driver_release_interface(), which manually calls the remove() callback of struct usb_driver and hence can't rely on the driver core.
Title usb: core: don't set drvdata to NULL in usb_unbind_interface()
First Time appeared Linux
Linux linux Kernel
CPEs cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
Vendors & Products Linux
Linux linux Kernel
References
Weaknesses
  • CWE-476

    NULL Pointer Dereference

  • CWE-690

    Unchecked Return Value to NULL Pointer Dereference

Sources

Status
PUBLISHED
Assigner
Linux
Published
Updated
Nov 30, 2026, 1:25 PM
Reserved
Nov 30, 2026, 1:22 PM
Status
Received
Published
Nov 30, 2026, 2:17 PM
Modified
Nov 30, 2026, 2:17 PM