# CVE-2025-40003: net: mscc: ocelot: Fix use-after-free caused by cyclic delayed work

> Archived entry. Full-text search covers entries since 2026-11-10; exact IDs work for all years.

- **Severity:** UNSCORED
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Unknown
- **EPSS:** 0.28% (percentile 13, 2026-11-26)
- **Published:** 2025-10-18T08:03:23.529Z
- **Modified:** 2026-10-30T13:18:12.457Z

## Who should check

- Anyone running Linux \>= a556c76adc052c979ef9e80f0cd3fa1379ff4943, \< 2dd7540183f7410e0dc85661defcc8035c14ddc9; \>= a556c76adc052c979ef9e80f0cd3fa1379ff4943, \< c4672bdc4730d28ee8d9f65386599298047c045e; \>= a556c76adc052c979ef9e80f0cd3fa1379ff4943, \< 70acdd1eb35ffb3afdcb59e4c3bbb178da411d0f; \>= a556c76adc052c979ef9e80f0cd3fa1379ff4943, \< c3363db5d0685a8d077ade706051bbccc75f7e14; \>= a556c76adc052c979ef9e80f0cd3fa1379ff4943, \< bc9ea787079671cb19a8b25ff9f02be5ef6bfcf5
- Anyone running Linux 4.18

## Description

In the Linux kernel, the following vulnerability has been resolved:

net: mscc: ocelot: Fix use-after-free caused by cyclic delayed work

The origin code calls cancel\_delayed\_work() in ocelot\_stats\_deinit()
to cancel the cyclic delayed work item ocelot-\>stats\_work. However,
cancel\_delayed\_work() may fail to cancel the work item if it is already
executing. While destroy\_workqueue() does wait for all pending work items
in the work queue to complete before destroying the work queue, it cannot
prevent the delayed work item from being rescheduled within the
ocelot\_check\_stats\_work() function. This limitation exists because the
delayed work item is only enqueued into the work queue after its timer
expires. Before the timer expiration, destroy\_workqueue() has no visibility
of this pending work item. Once the work queue appears empty,
destroy\_workqueue() proceeds with destruction. When the timer eventually
expires, the delayed work item gets queued again, leading to the following
warning:

workqueue: cannot queue ocelot\_check\_stats\_work on wq ocelot-switch-stats
WARNING: CPU: 2 PID: 0 at kernel/workqueue.c:2255 \_\_queue\_work+0x875/0xaf0
...
RIP: 0010:\_\_queue\_work+0x875/0xaf0
...
RSP: 0018:ffff88806d108b10 EFLAGS: 00010086
RAX: 0000000000000000 RBX: 0000000000000101 RCX: 0000000000000027
RDX: 0000000000000027 RSI: 0000000000000004 RDI: ffff88806d123e88
RBP: ffffffff813c3170 R08: 0000000000000000 R09: ffffed100da247d2
R10: ffffed100da247d1 R11: ffff88806d123e8b R12: ffff88800c00f000
R13: ffff88800d7285c0 R14: ffff88806d0a5580 R15: ffff88800d7285a0
FS:  0000000000000000(0000) GS:ffff8880e5725000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fe18e45ea10 CR3: 0000000005e6c000 CR4: 00000000000006f0
Call Trace:
 \<IRQ\>
 ? kasan\_report+0xc6/0xf0
 ? \_\_pfx\_delayed\_work\_timer\_fn+0x10/0x10
 ? \_\_pfx\_delayed\_work\_timer\_fn+0x10/0x10
 call\_timer\_fn+0x25/0x1c0
 \_\_run\_timer\_base.part.0+0x3be/0x8c0
 ? \_\_pfx\_delayed\_work\_timer\_fn+0x10/0x10
 ? rcu\_sched\_clock\_irq+0xb06/0x27d0
 ? \_\_pfx\_\_\_run\_timer\_base.part.0+0x10/0x10
 ? try\_to\_wake\_up+0xb15/0x1960
 ? \_raw\_spin\_lock\_irq+0x80/0xe0
 ? \_\_pfx\_\_raw\_spin\_lock\_irq+0x10/0x10
 tmigr\_handle\_remote\_up+0x603/0x7e0
 ? \_\_pfx\_tmigr\_handle\_remote\_up+0x10/0x10
 ? sched\_balance\_trigger+0x1c0/0x9f0
 ? sched\_tick+0x221/0x5a0
 ? \_raw\_spin\_lock\_irq+0x80/0xe0
 ? \_\_pfx\_\_raw\_spin\_lock\_irq+0x10/0x10
 ? tick\_nohz\_handler+0x339/0x440
 ? \_\_pfx\_tmigr\_handle\_remote\_up+0x10/0x10
 \_\_walk\_groups.isra.0+0x42/0x150
 tmigr\_handle\_remote+0x1f4/0x2e0
 ? \_\_pfx\_tmigr\_handle\_remote+0x10/0x10
 ? ktime\_get+0x60/0x140
 ? lapic\_next\_event+0x11/0x20
 ? clockevents\_program\_event+0x1d4/0x2a0
 ? hrtimer\_interrupt+0x322/0x780
 handle\_softirqs+0x16a/0x550
 irq\_exit\_rcu+0xaf/0xe0
 sysvec\_apic\_timer\_interrupt+0x70/0x80
 \</IRQ\>
...

The following diagram reveals the cause of the above warning:

CPU 0 (remove)             \| CPU 1 (delayed work callback)
mscc\_ocelot\_remove()       \|
  ocelot\_deinit()          \| ocelot\_check\_stats\_work()
    ocelot\_stats\_deinit()  \|
      cancel\_delayed\_work()\|   ...
                           \|   queue\_delayed\_work()
      destroy\_workqueue()  \| (wait a time)
                           \| \_\_queue\_work() //UAF

The above scenario actually constitutes a UAF vulnerability.

The ocelot\_stats\_deinit() is only invoked when initialization
failure or resource destruction, so we must ensure that any
delayed work items cannot be rescheduled.

Replace cancel\_delayed\_work() with disable\_delayed\_work\_sync()
to guarantee proper cancellation of the delayed work item and
ensure completion of any currently executing work before the
workqueue is deallocated.

A deadlock concern was considered: ocelot\_stats\_deinit() is called
in a process context and is not holding any locks that the delayed
work item might also need. Therefore, the use of the \_sync() variant
is safe here.

This bug was identified through static analysis. To reproduce the
issue and validate the fix, I simulated ocelot-swit
---truncated---

## Affected and fixed versions

- Linux: \>= a556c76adc052c979ef9e80f0cd3fa1379ff4943, \< 2dd7540183f7410e0dc85661defcc8035c14ddc9; \>= a556c76adc052c979ef9e80f0cd3fa1379ff4943, \< c4672bdc4730d28ee8d9f65386599298047c045e; \>= a556c76adc052c979ef9e80f0cd3fa1379ff4943, \< 70acdd1eb35ffb3afdcb59e4c3bbb178da411d0f; \>= a556c76adc052c979ef9e80f0cd3fa1379ff4943, \< c3363db5d0685a8d077ade706051bbccc75f7e14; \>= a556c76adc052c979ef9e80f0cd3fa1379ff4943, \< bc9ea787079671cb19a8b25ff9f02be5ef6bfcf5 (cvelist)
- Linux: 4.18 (cvelist)

## Mitigation

- No fix listed yet: follow the vendor advisory.

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by CVE-2025-40003. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2025-40003.md
Affected: Linux >= a556c76adc052c979ef9e80f0cd3fa1379ff4943, < 2dd7540183f7410e0dc85661defcc8035c14ddc9; >= a556c76adc052c979ef9e80f0cd3fa1379ff4943, < c4672bdc4730d28ee8d9f65386599298047c045e; >= a556c76adc052c979ef9e80f0cd3fa1379ff4943, < 70acdd1eb35ffb3afdcb59e4c3bbb178da411d0f; >= a556c76adc052c979ef9e80…
Fixed in: Linux 2dd7540183f7410e0dc85661defcc8035c14ddc9, Linux 70acdd1eb35ffb3afdcb59e4c3bbb178da411d0f

Steps:
1. Search this machine and project for Linux: dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
```

## FAQ

### Is CVE-2025-40003 being exploited?

There is no confirmed exploitation: CVE-2025-40003 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.28% chance of exploitation in the next 30 days (as of 2026-11-26).

### How serious is CVE-2025-40003?

It has no CVSS score yet. Unknown.

### Which versions are affected by CVE-2025-40003?

Linux \>= a556c76adc052c979ef9e80f0cd3fa1379ff4943, \< 2dd7540183f7410e0dc85661defcc8035c14ddc9; \>= a556c76adc052c979ef9e80f0cd3fa1379ff4943, \< c4672bdc4730d28ee8d9f65386599298047c045e; \>= a556c76adc052c979ef9e80f0cd3fa1379ff4943, \< 70acdd1eb35ffb3afdcb59e4c3bbb178da411d0f; \>= a556c76adc052c979ef9e80f0cd3fa1379ff4943, \< c3363db5d0685a8d077ade706051bbccc75f7e14; \>= a556c76adc052c979ef9e80f0cd3fa1379ff4943, \< bc9ea787079671cb19a8b25ff9f02be5ef6bfcf5; Linux 4.18.

### Is there a fix for CVE-2025-40003?

Yes. Fixed in Linux 2dd7540183f7410e0dc85661defcc8035c14ddc9, Linux 70acdd1eb35ffb3afdcb59e4c3bbb178da411d0f. No fix listed yet: follow the vendor advisory.

### How do I check if I'm affected by CVE-2025-40003?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

## References

- other: <https://git.kernel.org/stable/c/2dd7540183f7410e0dc85661defcc8035c14ddc9>
- other: <https://git.kernel.org/stable/c/c4672bdc4730d28ee8d9f65386599298047c045e>
- other: <https://git.kernel.org/stable/c/70acdd1eb35ffb3afdcb59e4c3bbb178da411d0f>
- other: <https://git.kernel.org/stable/c/c3363db5d0685a8d077ade706051bbccc75f7e14>
- other: <https://git.kernel.org/stable/c/bc9ea787079671cb19a8b25ff9f02be5ef6bfcf5>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- NVD: This product uses data from the NVD API but is not endorsed or certified by the NVD. <https://nvd.nist.gov/vuln/detail/CVE-2025-40003>

HTML: <https://flawdb.com/CVE-2025-40003> · JSON: <https://flawdb.com/api/v1/entries/CVE-2025-40003>
