CVE-2025-40027

Source
https://nvd.nist.gov/vuln/detail/CVE-2025-40027
Import Source
https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2025-40027.json
JSON Data
https://api.test.osv.dev/v1/vulns/CVE-2025-40027
Downstream
Related
Published
2025-10-28T09:32:34.162Z
Modified
2025-11-28T02:35:21.970257Z
Summary
net/9p: fix double req put in p9_fd_cancelled
Details

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

net/9p: fix double req put in p9fdcancelled

Syzkaller reports a KASAN issue as below:

general protection fault, probably for non-canonical address 0xfbd59c0000000021: 0000 [#1] PREEMPT SMP KASAN NOPTI KASAN: maybe wild-memory-access in range [0xdead000000000108-0xdead00000000010f] CPU: 0 PID: 5083 Comm: syz-executor.2 Not tainted 6.1.134-syzkaller-00037-g855bd1d7d838 #0 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.12.0-1 04/01/2014 RIP: 0010:listdel include/linux/list.h:114 [inline] RIP: 0010:listdelentry include/linux/list.h:137 [inline] RIP: 0010:listdel include/linux/list.h:148 [inline] RIP: 0010:p9fdcancelled+0xe9/0x200 net/9p/trans_fd.c:734

Call Trace: <TASK> p9clientflush+0x351/0x440 net/9p/client.c:614 p9clientrpc+0xb6b/0xc70 net/9p/client.c:734 p9clientversion net/9p/client.c:920 [inline] p9clientcreate+0xb51/0x1240 net/9p/client.c:1027 v9fssessioninit+0x1f0/0x18f0 fs/9p/v9fs.c:408 v9fsmount+0xba/0xcb0 fs/9p/vfssuper.c:126 legacygettree+0x108/0x220 fs/fscontext.c:632 vfsgettree+0x8e/0x300 fs/super.c:1573 donewmount fs/namespace.c:3056 [inline] pathmount+0x6a6/0x1e90 fs/namespace.c:3386 domount fs/namespace.c:3399 [inline] _dosysmount fs/namespace.c:3607 [inline] _sesysmount fs/namespace.c:3584 [inline] _x64sysmount+0x283/0x300 fs/namespace.c:3584 dosyscallx64 arch/x86/entry/common.c:51 [inline] dosyscall64+0x35/0x80 arch/x86/entry/common.c:81 entrySYSCALL64afterhwframe+0x6e/0xd8

This happens because of a race condition between:

  • The 9p client sending an invalid flush request and later cleaning it up;
  • The 9p client in p9readwork() canceled all pending requests.

    Thread 1                              Thread 2
    

    ... p9clientcreate() ... p9fdcreate() ... p9conncreate() ... // start Thread 2 INITWORK(&m->rq, p9readwork); p9readwork() ... p9clientrpc() ... ... p9conncancel() ... spinlock(&m->reqlock); ... p9fdcancelled() ... ... spinunlock(&m->reqlock); // status rewrite p9clientcb(m->client, req, REQSTATUSERROR) // first remove listdel(&req->req_list); ...

    spinlock(&m->reqlock) ... // second remove listdel(&req->reqlist); spinunlock(&m->reqlock) ...

Commit 74d6a5d56629 ("9p/transfd: Fix concurrency del of reqlist in p9fdcancelled/p9readwork") fixes a concurrency issue in the 9p filesystem client where the reqlist could be deleted simultaneously by both p9readwork and p9fdcancelled functions, but for the case where req->status equals REQSTATUS_RCVD.

Update the check for req->status in p9fdcancelled to skip processing not just received requests, but anything that is not SENT, as whatever changed the state from SENT also removed the request from its list.

Found by Linux Verification Center (linuxtesting.org) with Syzkaller.

[updated the check from status == RECV || status == ERROR to status != SENT]

Database specific
{
    "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2025/40xxx/CVE-2025-40027.json",
    "cna_assigner": "Linux"
}
References

Affected packages

Git / git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git

Affected ranges

Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
afd8d65411551839b7ab14a539d00075b2793451
Fixed
a5901a0dfb5964525990106706ae8b98db098226
Fixed
5c64c0b7b3446f7ed088a13bc8d7487d66534cbb
Fixed
c1db864270eb7fea94a9ef201da0c9dc1cbab7b8
Fixed
0e0097005abc02c9f262370674f855625f4f3fb4
Fixed
284e67a93b8c48952b6fc82129a8d3eb9dc73b06
Fixed
716dceb19a9f8ff6c9d3aee5a771a93d6a47a0b6
Fixed
448db01a48e1cdbbc31c995716a5dac1e52ba036
Fixed
94797b84cb9985022eb9cb3275c9497fbc883bb6
Fixed
674b56aa57f9379854cb6798c3bbcef7e7b51ab7

Linux / Kernel

Package

Name
Kernel

Affected ranges

Type
ECOSYSTEM
Events
Introduced
3.15.0
Fixed
5.4.301
Type
ECOSYSTEM
Events
Introduced
5.5.0
Fixed
5.10.246
Type
ECOSYSTEM
Events
Introduced
5.11.0
Fixed
5.15.195
Type
ECOSYSTEM
Events
Introduced
5.16.0
Fixed
6.1.156
Type
ECOSYSTEM
Events
Introduced
6.2.0
Fixed
6.6.111
Type
ECOSYSTEM
Events
Introduced
6.7.0
Fixed
6.12.52
Type
ECOSYSTEM
Events
Introduced
6.13.0
Fixed
6.16.12
Type
ECOSYSTEM
Events
Introduced
6.17.0
Fixed
6.17.2