CVE-2025-40054 json
f2fs: fix UAF issue in f2fs_merge_page_bio()
published 2025-10-28 12 mo ago modified 2026-10-19 20 d ago also EUVD-2025-36474
- cvss
- 7.8
- version 3.1, CNA
- cisa kev
- Not listed
- not in CISA's catalog
- epss
- 0.2%
- EPSS 0.2% chance of exploitation in 30 days, percentile 5%
- public exploits
- 0
- none known
Summary
In the Linux kernel, the following vulnerability has been resolved:
f2fs: fix UAF issue in f2fs_merge_page_bio()
As JY reported in bugzilla [1],
Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000 pc : [0xffffffe51d249484] f2fs_is_cp_guaranteed+0x70/0x98 lr : [0xffffffe51d24adbc] f2fs_merge_page_bio+0x520/0x6d4 CPU: 3 UID: 0 PID: 6790 Comm: kworker/u16:3 Tainted: P B W OE 6.12.30-android16-5-maybe-dirty-4k #1 5f7701c9cbf727d1eebe77c89bbbeb3371e895e5 Tainted: [P]=PROPRIETARY_MODULE, [B]=BAD_PAGE, [W]=WARN, [O]=OOT_MODULE, [E]=UNSIGNED_MODULE Workqueue: writeback wb_workfn (flush-254:49) Call trace: f2fs_is_cp_guaranteed+0x70/0x98 f2fs_inplace_write_data+0x174/0x2f4 f2fs_do_write_data_page+0x214/0x81c f2fs_write_single_data_page+0x28c/0x764 f2fs_write_data_pages+0x78c/0xce4 do_writepages+0xe8/0x2fc __writeback_single_inode+0x4c/0x4b4 writeback_sb_inodes+0x314/0x540 __writeback_inodes_wb+0xa4/0xf4 wb_writeback+0x160/0x448 wb_workfn+0x2f0/0x5dc process_scheduled_works+0x1c8/0x458 worker_thread+0x334/0x3f0 kthread+0x118/0x1ac ret_from_fork+0x10/0x20
[1] https://bugzilla.kernel.org/show_bug.cgi?id=220575
The panic was caused by UAF issue w/ below race condition:
kworker - writepages - f2fs_write_cache_pages - f2fs_write_single_data_page - f2fs_do_write_data_page - f2fs_inplace_write_data - f2fs_merge_page_bio - add_inu_page : cache page #1 into bio & cache bio in io->bio_list - f2fs_write_single_data_page - f2fs_do_write_data_page - f2fs_inplace_write_data - f2fs_merge_page_bio - add_inu_page : cache page #2 into bio which is linked in io->bio_list write - f2fs_write_begin : write page #1 - f2fs_folio_wait_writeback - f2fs_submit_merged_ipu_write - f2fs_submit_write_bio : submit bio which inclues page #1 and #2
software IRQ - f2fs_write_end_io - fscrypt_free_bounce_page : freed bounced page which belongs to page #2 - inc_page_count( , WB_DATA_TYPE(data_folio), false) : data_folio points to fio->encrypted_page the bounced page can be freed before accessing it in f2fs_is_cp_guarantee()
It can reproduce w/ below testcase: Run below script in shell #1: for ((i=1;i>0;i++)) do xfs_io -f /mnt/f2fs/enc/file \ -c "pwrite 0 32k" -c "fdatasync"
Run below script in shell #2: for ((i=1;i>0;i++)) do xfs_io -f /mnt/f2fs/enc/file \ -c "pwrite 0 32k" -c "fdatasync"
So, in f2fs_merge_page_bio(), let's avoid using fio->encrypted_page after commit page into internal ipu cache.
Patch / fix
- Linux Linux 5.10.266, 5.15.217, 6.1.184, 6.6.153, 6.12.105, 6.17.3, 6.18
- linux Debian 12 6.1.187-1
- linux Debian 13 6.12.105-1
- linux Debian 14 6.17.6-1
- linux-6.12 Debian 12 6.12.107-1~deb12u1
debian advisories DEBIAN-CVE-2025-40054
- linux Ubuntu 22.04 LTS 5.15.0-202.212
- linux Ubuntu 25.10 6.17.0-14.14
- linux-aws Ubuntu 22.04 LTS 5.15.0-1119.126
- linux-aws Ubuntu 25.10 6.17.0-1007.7
- linux-gcp Ubuntu 22.04 LTS 5.15.0-1120.130
- linux-gcp Ubuntu 25.10 6.17.0-1007.7
- linux-gke Ubuntu 22.04 LTS 5.15.0-1115.121
- linux-ibm Ubuntu 22.04 LTS 5.15.0-1113.117
ubuntu advisories UBUNTU-CVE-2025-40054
Ubuntu security data © Canonical Ltd., from https://github.com/canonical/ubuntu-security-notices via OSV; changed: normalised to fixed package versions per release. CC BY-SA 4.0
- kernel-source-longterm openSUSE Tumbleweed 6.18.16-1.1
- kernel-source openSUSE Tumbleweed 6.17.7-1.1
opensuse advisories openSUSE-SU-2026:10301-1openSUSE-SU-2025:15702-1
- git.kernel.org/stable/c/1f7b44b4a2b2939f08b279cbb9e6b5dcb8ffea32 commit
- git.kernel.org/stable/c/e193d8953647c8b575830852aa5ea0995b98d2b1 commit
- git.kernel.org/stable/c/410337c2301ae78a081e1b5ebbe8ec374fef4cb6 commit
- git.kernel.org/stable/c/68e094232dfe5027c4fd2dcded93d2d6800bae04 commit
- git.kernel.org/stable/c/7dd611131d82d7fc4212b555eb1103160bdad302 commit
- git.kernel.org/stable/c/01118321e0c8a5f3ece57d0d377bfc92d83cd210 commit
- git.kernel.org/stable/c/edf7e9040fc52c922db947f9c6c36f07377c52ea commit
Vendor advisories
What the vendors themselves say about their products: affected, fixed or not affected, and what to do.
red hat product security vex CVE-2025-40054 updated
kernel: f2fs: fix UAF issue in f2fs_merge_page_bio()
-
Red Hat Enterprise Linux 6 perf, kernel, python-perf, kernel-kdump, kernel-firmware, kernel-bootwrapper, +1 more Red Hat Enterprise Linux 7 perf, kernel, bpftool, kernel-rt, python-perf, kernel-kdump, +8 more Red Hat Enterprise Linux 8 perf, kernel, bpftool, kernel-rt, kernel-core, kernel-tools, +29 more Red Hat Enterprise Linux 9 rv, perf, rtla, kernel, bpftool, libperf, +83 more Red Hat Enterprise Linux 10 kernelnot affected: vulnerable code not present
Red Hat CSAF VEX © Red Hat, Inc., from https://security.access.redhat.com/data/csaf/v2/vex/; changed: reduced to product statuses and remediations. CC BY 4.0 · csaf
Exploit prediction
0.17% chance of exploitation in the next 30 days, higher than 5% of all scored CVEs (FIRST EPSS, 2026-11-08).
CVSS scores
| assigned by | version | score | vector |
|---|---|---|---|
| CNA | 3.1 | 7.8 | CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H |
Affected products
- Linux Linux
Classification
- Technology feeds
References
- git.kernel.org /stable/c/1f7b44b4a2b2939f08b279cbb9e6b5dcb8ffea32
- git.kernel.org /stable/c/e193d8953647c8b575830852aa5ea0995b98d2b1
- git.kernel.org /stable/c/410337c2301ae78a081e1b5ebbe8ec374fef4cb6
- git.kernel.org /stable/c/68e094232dfe5027c4fd2dcded93d2d6800bae04
- git.kernel.org /stable/c/7dd611131d82d7fc4212b555eb1103160bdad302
- git.kernel.org /stable/c/01118321e0c8a5f3ece57d0d377bfc92d83cd210
- git.kernel.org /stable/c/edf7e9040fc52c922db947f9c6c36f07377c52ea
Sources
- CVE List CVE-2025-40054
- NVD CVE-2025-40054
Fencer Vulns keeps one entry per vulnerability: the CVE id wins, then GHSA, and records that alias each other are merged, except that two CVEs always keep separate entries. The same data is available as JSON.