# CVE-2025-40064: smc: Fix use-after-free in \_\_pnet\_find\_base\_ndev().

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

- **Severity:** HIGH 7.8
- **CVSS:** 7.8 (v3.1, CNA) `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H`
- **CVSS metrics:** Attack vector: Local; Attack complexity: Low; Privileges required: Low; User interaction: None; Scope: Unchanged; Confidentiality impact: High; Integrity impact: High; Availability impact: High
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Not remotely exploitable (local or adjacent access needed)
- **EPSS:** 0.23% (percentile 8, 2026-11-26)
- **Published:** 2025-10-28T11:48:35.155Z
- **Modified:** 2026-10-19T21:10:00.160Z

## Who should check

- Anyone running Linux \>= 0afff91c6f5ecef27715ea71e34dc2baacba1060, \< 005a7173d8e4710646043a681af36f79ce05a29b; \>= 0afff91c6f5ecef27715ea71e34dc2baacba1060, \< 302dbed4760bcd19a661cc1c282d91bb7481307e; \>= 0afff91c6f5ecef27715ea71e34dc2baacba1060, \< 08aca586482e88aab9616a3e81bc36cad22674a5; \>= 0afff91c6f5ecef27715ea71e34dc2baacba1060, \< 233927b645cb7a14bb98d23ac72e4c7243a9f0d9; \>= 0afff91c6f5ecef27715ea71e34dc2baacba1060, \< 3d3466878afd8d43ec0ca2facfbc7f03e40d0f79
- Anyone running Linux 4.19

## Description

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

smc: Fix use-after-free in \_\_pnet\_find\_base\_ndev().

syzbot reported use-after-free of net\_device in \_\_pnet\_find\_base\_ndev(),
which was called during connect(). \[0\]

smc\_pnet\_find\_ism\_resource() fetches sk\_dst\_get(sk)-\>dev and passes
down to pnet\_find\_base\_ndev(), where RTNL is held.  Then, UAF happened
at \_\_pnet\_find\_base\_ndev() when the dev is first used.

This means dev had already been freed before acquiring RTNL in
pnet\_find\_base\_ndev().

While dev is going away, dst-\>dev could be swapped with blackhole\_netdev,
and the dev's refcnt by dst will be released.

We must hold dev's refcnt before calling smc\_pnet\_find\_ism\_resource().

Also, smc\_pnet\_find\_roce\_resource() has the same problem.

Let's use \_\_sk\_dst\_get() and dst\_dev\_rcu() in the two functions.

\[0\]:
BUG: KASAN: use-after-free in \_\_pnet\_find\_base\_ndev+0x1b1/0x1c0 net/smc/smc\_pnet.c:926
Read of size 1 at addr ffff888036bac33a by task syz.0.3632/18609

CPU: 1 UID: 0 PID: 18609 Comm: syz.0.3632 Not tainted syzkaller \#0 PREEMPT(full)
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/18/2025
Call Trace:
 \<TASK\>
 dump\_stack\_lvl+0x189/0x250 lib/dump\_stack.c:120
 print\_address\_description mm/kasan/report.c:378 \[inline\]
 print\_report+0xca/0x240 mm/kasan/report.c:482
 kasan\_report+0x118/0x150 mm/kasan/report.c:595
 \_\_pnet\_find\_base\_ndev+0x1b1/0x1c0 net/smc/smc\_pnet.c:926
 pnet\_find\_base\_ndev net/smc/smc\_pnet.c:946 \[inline\]
 smc\_pnet\_find\_ism\_by\_pnetid net/smc/smc\_pnet.c:1103 \[inline\]
 smc\_pnet\_find\_ism\_resource+0xef/0x390 net/smc/smc\_pnet.c:1154
 smc\_find\_ism\_device net/smc/af\_smc.c:1030 \[inline\]
 smc\_find\_proposal\_devices net/smc/af\_smc.c:1115 \[inline\]
 \_\_smc\_connect+0x372/0x1890 net/smc/af\_smc.c:1545
 smc\_connect+0x877/0xd90 net/smc/af\_smc.c:1715
 \_\_sys\_connect\_file net/socket.c:2086 \[inline\]
 \_\_sys\_connect+0x313/0x440 net/socket.c:2105
 \_\_do\_sys\_connect net/socket.c:2111 \[inline\]
 \_\_se\_sys\_connect net/socket.c:2108 \[inline\]
 \_\_x64\_sys\_connect+0x7a/0x90 net/socket.c:2108
 do\_syscall\_x64 arch/x86/entry/syscall\_64.c:63 \[inline\]
 do\_syscall\_64+0xfa/0x3b0 arch/x86/entry/syscall\_64.c:94
 entry\_SYSCALL\_64\_after\_hwframe+0x77/0x7f
RIP: 0033:0x7f47cbf8eba9
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 \<48\> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f47ccdb1038 EFLAGS: 00000246 ORIG\_RAX: 000000000000002a
RAX: ffffffffffffffda RBX: 00007f47cc1d5fa0 RCX: 00007f47cbf8eba9
RDX: 0000000000000010 RSI: 0000200000000280 RDI: 000000000000000b
RBP: 00007f47cc011e19 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f47cc1d6038 R14: 00007f47cc1d5fa0 R15: 00007ffc512f8aa8
 \</TASK\>

The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0xffff888036bacd00 pfn:0x36bac
flags: 0xfff00000000000(node=0\|zone=1\|lastcpupid=0x7ff)
raw: 00fff00000000000 ffffea0001243d08 ffff8880b863fdc0 0000000000000000
raw: ffff888036bacd00 0000000000000000 00000000ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page\_owner tracks the page as freed
page last allocated via order 2, migratetype Unmovable, gfp\_mask 0x446dc0(GFP\_KERNEL\_ACCOUNT\|\_\_GFP\_ZERO\|\_\_GFP\_NOWARN\|\_\_GFP\_RETRY\_MAYFAIL\|\_\_GFP\_COMP), pid 16741, tgid 16741 (syz-executor), ts 343313197788, free\_ts 380670750466
 set\_page\_owner include/linux/page\_owner.h:32 \[inline\]
 post\_alloc\_hook+0x240/0x2a0 mm/page\_alloc.c:1851
 prep\_new\_page mm/page\_alloc.c:1859 \[inline\]
 get\_page\_from\_freelist+0x21e4/0x22c0 mm/page\_alloc.c:3858
 \_\_alloc\_frozen\_pages\_noprof+0x181/0x370 mm/page\_alloc.c:5148
 alloc\_pages\_mpol+0x232/0x4a0 mm/mempolicy.c:2416
 \_\_\_kmalloc\_large\_node+0x5f/0x1b0 mm/slub.c:4317
 \_\_kmalloc\_large\_node\_noprof+0x18/0x90 mm/slub.c:4348
 \_\_do\_kmalloc\_node mm/slub.c:4364 \[inline\]
 \_\_kvmalloc\_node
---truncated---

## Affected and fixed versions

- Linux: \>= 0afff91c6f5ecef27715ea71e34dc2baacba1060, \< 005a7173d8e4710646043a681af36f79ce05a29b; \>= 0afff91c6f5ecef27715ea71e34dc2baacba1060, \< 302dbed4760bcd19a661cc1c282d91bb7481307e; \>= 0afff91c6f5ecef27715ea71e34dc2baacba1060, \< 08aca586482e88aab9616a3e81bc36cad22674a5; \>= 0afff91c6f5ecef27715ea71e34dc2baacba1060, \< 233927b645cb7a14bb98d23ac72e4c7243a9f0d9; \>= 0afff91c6f5ecef27715ea71e34dc2baacba1060, \< 3d3466878afd8d43ec0ca2facfbc7f03e40d0f79 (cvelist)
- Linux: 4.19 (cvelist)

## Mitigation

- Upgrade Linux to 3d3466878afd8d43ec0ca2facfbc7f03e40d0f79 or later.

## Check your systems with an agent

Paste this into a coding agent:

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

Details: https://flawdb.com/CVE-2025-40064.md
Affected: Linux >= 0afff91c6f5ecef27715ea71e34dc2baacba1060, < 005a7173d8e4710646043a681af36f79ce05a29b; >= 0afff91c6f5ecef27715ea71e34dc2baacba1060, < 302dbed4760bcd19a661cc1c282d91bb7481307e; >= 0afff91c6f5ecef27715ea71e34dc2baacba1060, < 08aca586482e88aab9616a3e81bc36cad22674a5; >= 0afff91c6f5ecef27715ea7…
Fixed in: Linux 005a7173d8e4710646043a681af36f79ce05a29b, Linux 302dbed4760bcd19a661cc1c282d91bb7481307e, Linux 08aca586482e88aab9616a3e81bc36cad22674a5, Linux 233927b645cb7a14bb98d23ac72e4c7243a9f0d9, Linux 3d3466878afd8d43ec0ca2facfbc7f03e40d0f79

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-40064 being exploited?

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

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

High: CVSS 7.8 (v3.1, scored by CNA). Not remotely exploitable (local or adjacent access needed).

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

Linux \>= 0afff91c6f5ecef27715ea71e34dc2baacba1060, \< 005a7173d8e4710646043a681af36f79ce05a29b; \>= 0afff91c6f5ecef27715ea71e34dc2baacba1060, \< 302dbed4760bcd19a661cc1c282d91bb7481307e; \>= 0afff91c6f5ecef27715ea71e34dc2baacba1060, \< 08aca586482e88aab9616a3e81bc36cad22674a5; \>= 0afff91c6f5ecef27715ea71e34dc2baacba1060, \< 233927b645cb7a14bb98d23ac72e4c7243a9f0d9; \>= 0afff91c6f5ecef27715ea71e34dc2baacba1060, \< 3d3466878afd8d43ec0ca2facfbc7f03e40d0f79; Linux 4.19.

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

Yes. Fixed in Linux 005a7173d8e4710646043a681af36f79ce05a29b, Linux 302dbed4760bcd19a661cc1c282d91bb7481307e, Linux 08aca586482e88aab9616a3e81bc36cad22674a5, Linux 233927b645cb7a14bb98d23ac72e4c7243a9f0d9, Linux 3d3466878afd8d43ec0ca2facfbc7f03e40d0f79. Upgrade Linux to 3d3466878afd8d43ec0ca2facfbc7f03e40d0f79 or later.

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

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/005a7173d8e4710646043a681af36f79ce05a29b>
- other: <https://git.kernel.org/stable/c/302dbed4760bcd19a661cc1c282d91bb7481307e>
- other: <https://git.kernel.org/stable/c/08aca586482e88aab9616a3e81bc36cad22674a5>
- other: <https://git.kernel.org/stable/c/233927b645cb7a14bb98d23ac72e4c7243a9f0d9>
- other: <https://git.kernel.org/stable/c/3d3466878afd8d43ec0ca2facfbc7f03e40d0f79>

## 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-40064>

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