usb: dwc3: gadget: Fix NULL pointer dereference in dwc3_gadget_suspend
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
8cca5c85393a7a490d4d7942c24d73d29cc77b3e| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
usb: dwc3: gadget: Fix NULL pointer dereference in dwc3_gadget_suspend
In current scenario if Plug-out and Plug-In performed continuously there could be a chance while checking for dwc->gadget_driver in dwc3_gadget_suspend, a NULL pointer dereference may occur.
Call Stack:
CPU1: CPU2: gadget_unbind_driver dwc3_suspend_common dwc3_gadget_stop dwc3_gadget_suspend dwc3_disconnect_gadget
CPU1 basically clears the variable and CPU2 checks the variable. Consider CPU1 is running and right before gadget_driver is cleared and in parallel CPU2 executes dwc3_gadget_suspend where it finds dwc->gadget_driver which is not NULL and resumes execution and then CPU1 completes execution. CPU2 executes dwc3_disconnect_gadget where it checks dwc->gadget_driver is already NULL because of which the NULL pointer deference occur.
From the CVE record · Linux
The Linux kernel’s USB DWC3 gadget code has a race between driver unbinding and gadget suspension. Repeated unplugging and plugging in a USB device can trigger a NULL pointer dereference when those operations overlap. The input does not establish whether an attacker can exploit this or what access they would need.
Engineers running Linux kernels with USB DWC3 gadget support should check their versions; affected versions are not specified.