CVE-2026-98764: usb: gadget: f_fs: Fix NULL pointer dereference in FUNCTIONFS_ENDPOINT_DESC
In the Linux kernel, the following vulnerability has been resolved:
usb: gadget: ffs: Fix NULL pointer dereference in FUNCTIONFSENDPOINTDESC
When user space sets up FunctionFS with only full-speed descriptors (e.g., flags = FUNCTIONFSHASFSDESC) and the gadget operates at a higher speed (such as USBSPEEDHIGH or USBSPEEDSUPER), configepbyspeed() detects that the function lacks descriptors for the current speed, logs a warning, and falls back to full-speed descriptors. The endpoint is then successfully enabled via usbepenable(), and epfile->ep becomes valid.
However, when user space subsequently issues the FUNCTIONFSENDPOINTDESC ioctl to query the endpoint descriptor, ffsepfileioctl() selects the descriptor index solely based on gadget->speed:
switch (epfile->ffs->gadget->speed) { case USBSPEEDSUPER: case USBSPEEDSUPERPLUS: descidx = 2; break; case USBSPEEDHIGH: descidx = 1; break; default: descidx = 0; } desc = epfile->ep->descs[descidx]; memcpy(&desc1, desc, desc->bLength);
Because user space only supplied full-speed descriptors, epfile->ep->descs[1] is NULL. Dereferencing desc->bLength triggers an immediate kernel NULL pointer dereference panic.
Fix this by falling back through lower speed descriptors if the current speed descriptor was not supplied, matching the fallback logic in configepbyspeed() and historical ffs behavior. If still missing, fall back to epfile->ep->ep->desc (the active descriptor), and return -EINVAL safely if no valid descriptor is found. In addition, mark desc as const to match struct usbep::desc and avoid discarding qualifiers.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
debian/linuxto a version that resolves this vulnerability.Fixed in 6.12.113-1 - Upgrade
Upgrade
debian/linuxto a version that resolves this vulnerability.Fixed in 7.2.10-1 - Upgrade
Upgrade
debian/linux-6.12to a version that resolves this vulnerability.Fixed in 6.12.113-1~deb12u1 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 5.10.273 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 5.15.224 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.1.191 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.6.160 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.12.113 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.18.56 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 7.2.10 - Upgrade
Upgrade
debian/linuxto a version that resolves this vulnerability.Fixed in 6.12.115-2Fixed in 7.2.12-1Fixed in 7.2.15-1
Event History
Frequently Asked Questions
Who is exposed to this issue?
Systems using the Linux kernel's FunctionFS USB gadget functionality are exposed when user space configures only full-speed descriptors and the gadget runs at high, SuperSpeed, or SuperSpeed Plus.
What must an attacker or local user be able to do to trigger the crash?
They need to set up FunctionFS with only full-speed descriptors, operate the gadget at a higher USB speed, and issue the FUNCTIONFS_ENDPOINT_DESC ioctl for the enabled endpoint. This causes the kernel to dereference a NULL higher-speed descriptor pointer.
What is the impact of successful exploitation?
The described result is an immediate kernel NULL pointer dereference panic, causing a denial of service.
What can be done before applying the fix?
Avoid exposing FunctionFS configurations that provide only full-speed descriptors when the gadget can operate at high or SuperSpeed. Supplying descriptors for the applicable operating speed prevents the missing descriptor condition described.
How can administrators identify potentially affected configurations?
Review FunctionFS userspace configuration for FUNCTIONFS_HAS_FS_DESC without corresponding higher-speed descriptors, then check whether the gadget may enumerate at USB_SPEED_HIGH, USB_SPEED_SUPER, or USB_SPEED_SUPER_PLUS. The vulnerable path logs a warning about missing descriptors for the current speed before falling back to full-speed descriptors.