CVE-2025-39945
Severity CVSS v4.0:
Pending analysis
Type:
CWE-416
Use After Free
Publication date:
04/10/2025
Last modified:
23/01/2026
Description
In the Linux kernel, the following vulnerability has been resolved:<br />
<br />
cnic: Fix use-after-free bugs in cnic_delete_task<br />
<br />
The original code uses cancel_delayed_work() in cnic_cm_stop_bnx2x_hw(),<br />
which does not guarantee that the delayed work item &#39;delete_task&#39; has<br />
fully completed if it was already running. Additionally, the delayed work<br />
item is cyclic, the flush_workqueue() in cnic_cm_stop_bnx2x_hw() only<br />
blocks and waits for work items that were already queued to the<br />
workqueue prior to its invocation. Any work items submitted after<br />
flush_workqueue() is called are not included in the set of tasks that the<br />
flush operation awaits. This means that after the cyclic work items have<br />
finished executing, a delayed work item may still exist in the workqueue.<br />
This leads to use-after-free scenarios where the cnic_dev is deallocated<br />
by cnic_free_dev(), while delete_task remains active and attempt to<br />
dereference cnic_dev in cnic_delete_task().<br />
<br />
A typical race condition is illustrated below:<br />
<br />
CPU 0 (cleanup) | CPU 1 (delayed work callback)<br />
cnic_netdev_event() |<br />
cnic_stop_hw() | cnic_delete_task()<br />
cnic_cm_stop_bnx2x_hw() | ...<br />
cancel_delayed_work() | /* the queue_delayed_work()<br />
flush_workqueue() | executes after flush_workqueue()*/<br />
| queue_delayed_work()<br />
cnic_free_dev(dev)//free | cnic_delete_task() //new instance<br />
| dev = cp->dev; //use<br />
<br />
Replace cancel_delayed_work() with cancel_delayed_work_sync() to ensure<br />
that the cyclic delayed work item is properly canceled and that any<br />
ongoing execution of the work item completes before the cnic_dev is<br />
deallocated. Furthermore, since cancel_delayed_work_sync() uses<br />
__flush_work(work, true) to synchronously wait for any currently<br />
executing instance of the work item to finish, the flush_workqueue()<br />
becomes redundant and should be removed.<br />
<br />
This bug was identified through static analysis. To reproduce the issue<br />
and validate the fix, I simulated the cnic PCI device in QEMU and<br />
introduced intentional delays — such as inserting calls to ssleep()<br />
within the cnic_delete_task() function — to increase the likelihood<br />
of triggering the bug.
Impact
Base Score 3.x
7.80
Severity 3.x
HIGH
Vulnerable products and versions
| CPE | From | Up to |
|---|---|---|
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 2.6.37 (including) | 5.4.300 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 5.5 (including) | 5.10.245 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 5.11 (including) | 5.15.194 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 5.16 (including) | 6.1.154 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 6.2 (including) | 6.6.108 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 6.7 (including) | 6.12.49 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 6.13 (including) | 6.16.9 (excluding) |
| cpe:2.3:o:linux:linux_kernel:6.17:rc1:*:*:*:*:*:* | ||
| cpe:2.3:o:linux:linux_kernel:6.17:rc2:*:*:*:*:*:* | ||
| cpe:2.3:o:linux:linux_kernel:6.17:rc3:*:*:*:*:*:* | ||
| cpe:2.3:o:linux:linux_kernel:6.17:rc4:*:*:*:*:*:* | ||
| cpe:2.3:o:linux:linux_kernel:6.17:rc5:*:*:*:*:*:* | ||
| cpe:2.3:o:linux:linux_kernel:6.17:rc6:*:*:*:*:*:* |
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/0405055930264ea8fd26f4131466fa7652e5e47d
- https://git.kernel.org/stable/c/0627e1481676669cae2df0d85b5ff13e7d24c390
- https://git.kernel.org/stable/c/6e33a7eed587062ca8161ad1f4584882a860d697
- https://git.kernel.org/stable/c/7b6a5b0a6b392263c3767fc945b311ea04b34bbd
- https://git.kernel.org/stable/c/8eeb2091e72d75df8ceaa2172638d61b4cf8929a
- https://git.kernel.org/stable/c/cfa7d9b1e3a8604afc84e9e51d789c29574fb216
- https://git.kernel.org/stable/c/e1fcd4a9c09feac0902a65615e866dbf22616125
- https://git.kernel.org/stable/c/fde6e73189f40ebcf0633aed2b68e731c25f3aa3



