CVE-2023-52855
Severity CVSS v4.0:
Pending analysis
Type:
CWE-476
NULL Pointer Dereference
Publication date:
21/05/2024
Last modified:
02/04/2025
Description
In the Linux kernel, the following vulnerability has been resolved:<br />
<br />
usb: dwc2: fix possible NULL pointer dereference caused by driver concurrency<br />
<br />
In _dwc2_hcd_urb_enqueue(), "urb->hcpriv = NULL" is executed without<br />
holding the lock "hsotg->lock". In _dwc2_hcd_urb_dequeue():<br />
<br />
spin_lock_irqsave(&hsotg->lock, flags);<br />
...<br />
if (!urb->hcpriv) {<br />
dev_dbg(hsotg->dev, "## urb->hcpriv is NULL ##\n");<br />
goto out;<br />
}<br />
rc = dwc2_hcd_urb_dequeue(hsotg, urb->hcpriv); // Use urb->hcpriv<br />
...<br />
out:<br />
spin_unlock_irqrestore(&hsotg->lock, flags);<br />
<br />
When _dwc2_hcd_urb_enqueue() and _dwc2_hcd_urb_dequeue() are<br />
concurrently executed, the NULL check of "urb->hcpriv" can be executed<br />
before "urb->hcpriv = NULL". After urb->hcpriv is NULL, it can be used<br />
in the function call to dwc2_hcd_urb_dequeue(), which can cause a NULL<br />
pointer dereference.<br />
<br />
This possible bug is found by an experimental static analysis tool<br />
developed by myself. This tool analyzes the locking APIs to extract<br />
function pairs that can be concurrently executed, and then analyzes the<br />
instructions in the paired functions to identify possible concurrency<br />
bugs including data races and atomicity violations. The above possible<br />
bug is reported, when my tool analyzes the source code of Linux 6.5.<br />
<br />
To fix this possible bug, "urb->hcpriv = NULL" should be executed with<br />
holding the lock "hsotg->lock". After using this patch, my tool never<br />
reports the possible bug, with the kernelconfiguration allyesconfig for<br />
x86_64. Because I have no associated hardware, I cannot test the patch<br />
in runtime testing, and just verify it according to the code logic.
Impact
Base Score 3.x
5.50
Severity 3.x
MEDIUM
Vulnerable products and versions
| CPE | From | Up to |
|---|---|---|
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 4.2 (including) | 4.14.330 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 4.15 (including) | 4.19.299 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 4.20 (including) | 5.4.261 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 5.5 (including) | 5.10.201 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 5.11 (including) | 5.15.139 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 5.16 (including) | 6.1.63 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 6.2 (including) | 6.5.12 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 6.6 (including) | 6.6.2 (excluding) |
To consult the complete list of CPE names with products and versions, see this page
References to Advisories, Solutions, and Tools
- https://git.kernel.org/stable/c/14c9ec34e8118fbffd7f5431814d767726323e72
- https://git.kernel.org/stable/c/3e851a77a13ce944d703721793f49ee82622986d
- https://git.kernel.org/stable/c/64c47749fc7507ed732e155c958253968c1d275e
- https://git.kernel.org/stable/c/6b21a22728852d020a6658d39cd7bb7e14b07790
- https://git.kernel.org/stable/c/a7bee9598afb38004841a41dd8fe68c1faff4e90
- https://git.kernel.org/stable/c/bdb3dd4096302d6b87441fdc528439f171b04be6
- https://git.kernel.org/stable/c/ef307bc6ef04e8c1ea843231db58e3afaafa9fa6
- https://git.kernel.org/stable/c/fcaafb574fc88a52dce817f039f7ff2f9da38001
- https://git.kernel.org/stable/c/fed492aa6493a91a77ebd51da6fb939c98d94a0d
- https://git.kernel.org/stable/c/14c9ec34e8118fbffd7f5431814d767726323e72
- https://git.kernel.org/stable/c/3e851a77a13ce944d703721793f49ee82622986d
- https://git.kernel.org/stable/c/64c47749fc7507ed732e155c958253968c1d275e
- https://git.kernel.org/stable/c/6b21a22728852d020a6658d39cd7bb7e14b07790
- https://git.kernel.org/stable/c/a7bee9598afb38004841a41dd8fe68c1faff4e90
- https://git.kernel.org/stable/c/bdb3dd4096302d6b87441fdc528439f171b04be6
- https://git.kernel.org/stable/c/ef307bc6ef04e8c1ea843231db58e3afaafa9fa6
- https://git.kernel.org/stable/c/fcaafb574fc88a52dce817f039f7ff2f9da38001
- https://git.kernel.org/stable/c/fed492aa6493a91a77ebd51da6fb939c98d94a0d



