Vulnerability · Published Oct 28, 2025 · Assigned by Linux
CVE-2025-40054f2fs: fix UAF issue in f2fs_merge_page_bio()
High 7.8
In plain English
A high-severity security flaw in Linux from Linux. There are no confirmed reports of exploitation so far. The chance it is exploited in the next 30 days is estimated at 0.2% (higher than 6% of all known vulnerabilities). Fixed versions are available - upgrade the affected package.
Official description
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.
Affected packages & fixed versions
| Ecosystem | Package | Fixed in | Advisory |
|---|---|---|---|
| Debian:12 | linux | 6.1.187-1 | DEBIAN-CVE-2025-40054 |
| Debian:13 | linux | 6.12.105-1 | DEBIAN-CVE-2025-40054 |
| Debian:14 | linux | 6.17.6-1 | DEBIAN-CVE-2025-40054 |
| Debian:12 | linux-6.12 | 6.12.107-1~deb12u1 | DEBIAN-CVE-2025-40054 |
| Ubuntu:22.04:LTS | linux | 5.15.0-202.212 | UBUNTU-CVE-2025-40054 |
| Ubuntu:24.04:LTS | linux | no fix listed | UBUNTU-CVE-2025-40054 |
| Ubuntu:25.10 | linux | 6.17.0-14.14 | USN-8029-1 |
| Ubuntu:25.10 | linux | 6.17.0-14.14 | UBUNTU-CVE-2025-40054 |
| Ubuntu:22.04:LTS | linux-allwinner-5.19 | no fix listed | UBUNTU-CVE-2025-40054 |
| Ubuntu:22.04:LTS | linux-aws | 5.15.0-1119.126 | UBUNTU-CVE-2025-40054 |
| Ubuntu:24.04:LTS | linux-aws | no fix listed | UBUNTU-CVE-2025-40054 |
| Ubuntu:25.10 | linux-aws | 6.17.0-1007.7 | UBUNTU-CVE-2025-40054 |
| Ubuntu:25.10 | linux-aws | 6.17.0-1007.7 | USN-8029-2 |
| Ubuntu:22.04:LTS | linux-aws-5.19 | no fix listed | UBUNTU-CVE-2025-40054 |
| Ubuntu:24.04:LTS | linux-aws-6.14 | no fix listed | UBUNTU-CVE-2025-40054 |
| Ubuntu:24.04:LTS | linux-aws-6.17 | 6.17.0-1007.7~24.04.1 | UBUNTU-CVE-2025-40054 |
| Ubuntu:22.04:LTS | linux-aws-6.2 | no fix listed | UBUNTU-CVE-2025-40054 |
| Ubuntu:22.04:LTS | linux-aws-6.5 | no fix listed | UBUNTU-CVE-2025-40054 |
| Ubuntu:22.04:LTS | linux-aws-6.8 | no fix listed | UBUNTU-CVE-2025-40054 |
| Ubuntu:22.04:LTS | linux-azure | 5.15.0-1125.134 | UBUNTU-CVE-2025-40054 |
| Ubuntu:24.04:LTS | linux-azure | no fix listed | UBUNTU-CVE-2025-40054 |
| Ubuntu:25.10 | linux-azure | 6.17.0-1008.8 | UBUNTU-CVE-2025-40054 |
| Ubuntu:25.10 | linux-azure | 6.17.0-1008.8 | USN-8029-3 |
| Ubuntu:22.04:LTS | linux-azure-5.19 | no fix listed | UBUNTU-CVE-2025-40054 |
| Ubuntu:24.04:LTS | linux-azure-6.11 | no fix listed | UBUNTU-CVE-2025-40054 |
| Ubuntu:24.04:LTS | linux-azure-6.14 | no fix listed | UBUNTU-CVE-2025-40054 |
| Ubuntu:22.04:LTS | linux-azure-6.2 | no fix listed | UBUNTU-CVE-2025-40054 |
| Ubuntu:22.04:LTS | linux-azure-6.5 | no fix listed | UBUNTU-CVE-2025-40054 |
| Ubuntu:22.04:LTS | linux-azure-6.8 | no fix listed | UBUNTU-CVE-2025-40054 |
| Ubuntu:22.04:LTS | linux-azure-fde | 5.15.0-1124.133 | UBUNTU-CVE-2025-40054 |
| Ubuntu:24.04:LTS | linux-azure-fde | no fix listed | UBUNTU-CVE-2025-40054 |
| Ubuntu:25.10 | linux-azure-fde | no fix listed | UBUNTU-CVE-2025-40054 |
| Ubuntu:22.04:LTS | linux-azure-fde-5.19 | no fix listed | UBUNTU-CVE-2025-40054 |
| Ubuntu:24.04:LTS | linux-azure-fde-6.14 | no fix listed | UBUNTU-CVE-2025-40054 |
| Ubuntu:24.04:LTS | linux-azure-fde-6.17 | no fix listed | UBUNTU-CVE-2025-40054 |
| Ubuntu:22.04:LTS | linux-azure-fde-6.2 | no fix listed | UBUNTU-CVE-2025-40054 |
| Ubuntu:22.04:LTS | linux-azure-fde-6.8 | no fix listed | UBUNTU-CVE-2025-40054 |
| Ubuntu:24.04:LTS | linux-azure-nvidia | no fix listed | UBUNTU-CVE-2025-40054 |
| Ubuntu:24.04:LTS | linux-azure-nvidia-6.14 | no fix listed | UBUNTU-CVE-2025-40054 |
| Ubuntu:22.04:LTS | linux-gcp | 5.15.0-1120.130 | UBUNTU-CVE-2025-40054 |
| Ubuntu:24.04:LTS | linux-gcp | no fix listed | UBUNTU-CVE-2025-40054 |
| Ubuntu:25.10 | linux-gcp | 6.17.0-1007.7 | USN-8030-1 |
| Ubuntu:25.10 | linux-gcp | 6.17.0-1007.7 | UBUNTU-CVE-2025-40054 |
| Ubuntu:22.04:LTS | linux-gcp-5.19 | no fix listed | UBUNTU-CVE-2025-40054 |
| Ubuntu:24.04:LTS | linux-gcp-6.11 | no fix listed | UBUNTU-CVE-2025-40054 |
| Ubuntu:24.04:LTS | linux-gcp-6.14 | no fix listed | UBUNTU-CVE-2025-40054 |
| Ubuntu:24.04:LTS | linux-gcp-6.17 | 6.17.0-1008.8~24.04.1 | UBUNTU-CVE-2025-40054 |
| Ubuntu:22.04:LTS | linux-gcp-6.2 | no fix listed | UBUNTU-CVE-2025-40054 |
| Ubuntu:22.04:LTS | linux-gcp-6.5 | no fix listed | UBUNTU-CVE-2025-40054 |
| Ubuntu:22.04:LTS | linux-gcp-6.8 | no fix listed | UBUNTU-CVE-2025-40054 |
| Ubuntu:22.04:LTS | linux-gke | 5.15.0-1115.121 | UBUNTU-CVE-2025-40054 |
| Ubuntu:24.04:LTS | linux-gke | no fix listed | UBUNTU-CVE-2025-40054 |
| Ubuntu:22.04:LTS | linux-gkeop | 5.15.0-1102.110 | UBUNTU-CVE-2025-40054 |
| Ubuntu:24.04:LTS | linux-gkeop | no fix listed | UBUNTU-CVE-2025-40054 |
| Ubuntu:22.04:LTS | linux-hwe-5.19 | no fix listed | UBUNTU-CVE-2025-40054 |
| Ubuntu:24.04:LTS | linux-hwe-6.11 | no fix listed | UBUNTU-CVE-2025-40054 |
| Ubuntu:24.04:LTS | linux-hwe-6.14 | no fix listed | UBUNTU-CVE-2025-40054 |
| Ubuntu:22.04:LTS | linux-hwe-6.2 | no fix listed | UBUNTU-CVE-2025-40054 |
| Ubuntu:22.04:LTS | linux-hwe-6.5 | no fix listed | UBUNTU-CVE-2025-40054 |
| Ubuntu:22.04:LTS | linux-hwe-6.8 | no fix listed | UBUNTU-CVE-2025-40054 |
| Ubuntu:22.04:LTS | linux-ibm | 5.15.0-1113.117 | UBUNTU-CVE-2025-40054 |
| Ubuntu:24.04:LTS | linux-ibm | no fix listed | UBUNTU-CVE-2025-40054 |
| Ubuntu:22.04:LTS | linux-ibm-6.8 | no fix listed | UBUNTU-CVE-2025-40054 |
| Ubuntu:22.04:LTS | linux-intel-iot-realtime | no fix listed | UBUNTU-CVE-2025-40054 |
| Ubuntu:22.04:LTS | linux-intel-iotg | 5.15.0-1114.120 | UBUNTU-CVE-2025-40054 |
| Ubuntu:22.04:LTS | linux-kvm | 5.15.0-1111.116 | UBUNTU-CVE-2025-40054 |
| Ubuntu:22.04:LTS | linux-lowlatency | 5.15.0-197.207 | UBUNTU-CVE-2025-40054 |
| Ubuntu:24.04:LTS | linux-lowlatency | no fix listed | UBUNTU-CVE-2025-40054 |
| Ubuntu:22.04:LTS | linux-lowlatency-hwe-5.19 | no fix listed | UBUNTU-CVE-2025-40054 |
| Ubuntu:24.04:LTS | linux-lowlatency-hwe-6.11 | no fix listed | UBUNTU-CVE-2025-40054 |
| Ubuntu:22.04:LTS | linux-lowlatency-hwe-6.2 | no fix listed | UBUNTU-CVE-2025-40054 |
| Ubuntu:22.04:LTS | linux-lowlatency-hwe-6.5 | no fix listed | UBUNTU-CVE-2025-40054 |
| Ubuntu:22.04:LTS | linux-lowlatency-hwe-6.8 | no fix listed | UBUNTU-CVE-2025-40054 |
| Ubuntu:22.04:LTS | linux-nvidia | 5.15.0-1114.115 | UBUNTU-CVE-2025-40054 |
| Ubuntu:24.04:LTS | linux-nvidia | no fix listed | UBUNTU-CVE-2025-40054 |
| Ubuntu:24.04:LTS | linux-nvidia-6.11 | no fix listed | UBUNTU-CVE-2025-40054 |
| Ubuntu:24.04:LTS | linux-nvidia-6.17 | 6.17.0-1008.8 | UBUNTU-CVE-2025-40054 |
| Ubuntu:22.04:LTS | linux-nvidia-6.2 | no fix listed | UBUNTU-CVE-2025-40054 |
| Ubuntu:22.04:LTS | linux-nvidia-6.5 | no fix listed | UBUNTU-CVE-2025-40054 |
| Ubuntu:22.04:LTS | linux-nvidia-6.8 | no fix listed | UBUNTU-CVE-2025-40054 |
| Ubuntu:24.04:LTS | linux-nvidia-lowlatency | no fix listed | UBUNTU-CVE-2025-40054 |
| Ubuntu:22.04:LTS | linux-nvidia-tegra | 5.15.0-1070.72 | UBUNTU-CVE-2025-40054 |
| Ubuntu:24.04:LTS | linux-nvidia-tegra | 6.8.0-1035.38 | UBUNTU-CVE-2025-40054 |
| Ubuntu:22.04:LTS | linux-nvidia-tegra-igx | 5.15.0-1059.59 | UBUNTU-CVE-2025-40054 |
| Ubuntu:22.04:LTS | linux-oem-5.17 | no fix listed | UBUNTU-CVE-2025-40054 |
| Ubuntu:22.04:LTS | linux-oem-6.0 | no fix listed | UBUNTU-CVE-2025-40054 |
| Ubuntu:22.04:LTS | linux-oem-6.1 | no fix listed | UBUNTU-CVE-2025-40054 |
| Ubuntu:24.04:LTS | linux-oem-6.11 | no fix listed | UBUNTU-CVE-2025-40054 |
| Ubuntu:24.04:LTS | linux-oem-6.14 | no fix listed | UBUNTU-CVE-2025-40054 |
| Ubuntu:24.04:LTS | linux-oem-6.17 | 6.17.0-1011.11 | UBUNTU-CVE-2025-40054 |
| Ubuntu:24.04:LTS | linux-oem-6.17 | 6.17.0-1011.11 | USN-8048-1 |
| Ubuntu:22.04:LTS | linux-oem-6.5 | no fix listed | UBUNTU-CVE-2025-40054 |
| Ubuntu:24.04:LTS | linux-oem-6.8 | no fix listed | UBUNTU-CVE-2025-40054 |
| Ubuntu:22.04:LTS | linux-oracle | 5.15.0-1116.122 | UBUNTU-CVE-2025-40054 |
| Ubuntu:24.04:LTS | linux-oracle | no fix listed | UBUNTU-CVE-2025-40054 |
| Ubuntu:25.10 | linux-oracle | 6.17.0-1007.7 | UBUNTU-CVE-2025-40054 |
| Ubuntu:25.10 | linux-oracle | 6.17.0-1007.7 | USN-8029-2 |
| Ubuntu:24.04:LTS | linux-oracle-6.14 | no fix listed | UBUNTU-CVE-2025-40054 |
| Ubuntu:24.04:LTS | linux-oracle-6.17 | 6.17.0-1007.7~24.04.1 | UBUNTU-CVE-2025-40054 |
| Ubuntu:22.04:LTS | linux-oracle-6.5 | no fix listed | UBUNTU-CVE-2025-40054 |
| Ubuntu:22.04:LTS | linux-oracle-6.8 | no fix listed | UBUNTU-CVE-2025-40054 |
| Ubuntu:22.04:LTS | linux-raspi | no fix listed | UBUNTU-CVE-2025-40054 |
| Ubuntu:24.04:LTS | linux-raspi | no fix listed | UBUNTU-CVE-2025-40054 |
| Ubuntu:25.10 | linux-raspi | 6.17.0-1008.8 | USN-8029-1 |
| Ubuntu:25.10 | linux-raspi | 6.17.0-1008.8 | UBUNTU-CVE-2025-40054 |
| Ubuntu:24.04:LTS | linux-raspi-realtime | no fix listed | UBUNTU-CVE-2025-40054 |
| Ubuntu:22.04:LTS | linux-realtime | no fix listed | UBUNTU-CVE-2025-40054 |
| Ubuntu:24.04:LTS | linux-realtime | no fix listed | UBUNTU-CVE-2025-40054 |
| Ubuntu:25.10 | linux-realtime | 6.17.0-1006.7 | UBUNTU-CVE-2025-40054 |
| Ubuntu:25.10 | linux-realtime | 6.17.0-1006.7 | USN-8029-1 |
| Ubuntu:22.04:LTS | linux-riscv | no fix listed | UBUNTU-CVE-2025-40054 |
| Ubuntu:24.04:LTS | linux-riscv | no fix listed | UBUNTU-CVE-2025-40054 |
| Ubuntu:25.10 | linux-riscv | 6.17.0-14.14.1 | UBUNTU-CVE-2025-40054 |
| Ubuntu:22.04:LTS | linux-riscv-5.19 | no fix listed | UBUNTU-CVE-2025-40054 |
| Ubuntu:24.04:LTS | linux-riscv-6.14 | no fix listed | UBUNTU-CVE-2025-40054 |
| Ubuntu:22.04:LTS | linux-riscv-6.5 | no fix listed | UBUNTU-CVE-2025-40054 |
| Ubuntu:22.04:LTS | linux-riscv-6.8 | no fix listed | UBUNTU-CVE-2025-40054 |
| Ubuntu:22.04:LTS | linux-starfive-5.19 | no fix listed | UBUNTU-CVE-2025-40054 |
| Ubuntu:22.04:LTS | linux-starfive-6.2 | no fix listed | UBUNTU-CVE-2025-40054 |
| Ubuntu:22.04:LTS | linux-starfive-6.5 | no fix listed | UBUNTU-CVE-2025-40054 |
| Ubuntu:24.04:LTS | linux-vmware | no fix listed | UBUNTU-CVE-2025-40054 |
| Ubuntu:24.04:LTS | linux-xilinx | no fix listed | UBUNTU-CVE-2025-40054 |
| Ubuntu:22.04:LTS | linux-xilinx-zynqmp | no fix listed | UBUNTU-CVE-2025-40054 |
Affected products (as reported)
| Vendor | Product | Versions |
|---|---|---|
| Linux | Linux | 0b20fcec8651569935a10afe03fedc0b812d044e – before 1f7b44b4a2b2939f08b279cbb9e6b5dcb8ffea320b20fcec8651569935a10afe03fedc0b812d044e – before e193d8953647c8b575830852aa5ea0995b98d2b10b20fcec8651569935a10afe03fedc0b812d044e – before 410337c2301ae78a081e1b5ebbe8ec374fef4cb60b20fcec8651569935a10afe03fedc0b812d044e – before 68e094232dfe5027c4fd2dcded93d2d6800bae040b20fcec8651569935a10afe03fedc0b812d044e – before 7dd611131d82d7fc4212b555eb1103160bdad3020b20fcec8651569935a10afe03fedc0b812d044e – before 01118321e0c8a5f3ece57d0d377bfc92d83cd2100b20fcec8651569935a10afe03fedc0b812d044e – before edf7e9040fc52c922db947f9c6c36f07377c52ea |
| Linux | Linux | 5.5 |
References
- https://git.kernel.org/stable/c/1f7b44b4a2b2939f08b279cbb9e6b5dcb8ffea32
- https://git.kernel.org/stable/c/e193d8953647c8b575830852aa5ea0995b98d2b1
- https://git.kernel.org/stable/c/410337c2301ae78a081e1b5ebbe8ec374fef4cb6
- https://git.kernel.org/stable/c/68e094232dfe5027c4fd2dcded93d2d6800bae04
- https://git.kernel.org/stable/c/7dd611131d82d7fc4212b555eb1103160bdad302
- https://git.kernel.org/stable/c/01118321e0c8a5f3ece57d0d377bfc92d83cd210
- https://git.kernel.org/stable/c/edf7e9040fc52c922db947f9c6c36f07377c52ea