{
  "public_date" : "2025-10-28T00:00:00Z",
  "bugzilla" : {
    "description" : "kernel: f2fs: fix UAF issue in f2fs_merge_page_bio()",
    "id" : "2406765",
    "url" : "https://bugzilla.redhat.com/show_bug.cgi?id=2406765"
  },
  "details" : [ "In the Linux kernel, the following vulnerability has been resolved:\nf2fs: fix UAF issue in f2fs_merge_page_bio()\nAs JY reported in bugzilla [1],\nUnable to handle kernel NULL pointer dereference at virtual address 0000000000000000\npc : [0xffffffe51d249484] f2fs_is_cp_guaranteed+0x70/0x98\nlr : [0xffffffe51d24adbc] f2fs_merge_page_bio+0x520/0x6d4\nCPU: 3 UID: 0 PID: 6790 Comm: kworker/u16:3 Tainted: P    B   W  OE      6.12.30-android16-5-maybe-dirty-4k #1 5f7701c9cbf727d1eebe77c89bbbeb3371e895e5\nTainted: [P]=PROPRIETARY_MODULE, [B]=BAD_PAGE, [W]=WARN, [O]=OOT_MODULE, [E]=UNSIGNED_MODULE\nWorkqueue: writeback wb_workfn (flush-254:49)\nCall trace:\nf2fs_is_cp_guaranteed+0x70/0x98\nf2fs_inplace_write_data+0x174/0x2f4\nf2fs_do_write_data_page+0x214/0x81c\nf2fs_write_single_data_page+0x28c/0x764\nf2fs_write_data_pages+0x78c/0xce4\ndo_writepages+0xe8/0x2fc\n__writeback_single_inode+0x4c/0x4b4\nwriteback_sb_inodes+0x314/0x540\n__writeback_inodes_wb+0xa4/0xf4\nwb_writeback+0x160/0x448\nwb_workfn+0x2f0/0x5dc\nprocess_scheduled_works+0x1c8/0x458\nworker_thread+0x334/0x3f0\nkthread+0x118/0x1ac\nret_from_fork+0x10/0x20\n[1] https://bugzilla.kernel.org/show_bug.cgi?id=220575\nThe panic was caused by UAF issue w/ below race condition:\nkworker\n- writepages\n- f2fs_write_cache_pages\n- f2fs_write_single_data_page\n- f2fs_do_write_data_page\n- f2fs_inplace_write_data\n- f2fs_merge_page_bio\n- add_inu_page\n: cache page #1 into bio & cache bio in\nio->bio_list\n- f2fs_write_single_data_page\n- f2fs_do_write_data_page\n- f2fs_inplace_write_data\n- f2fs_merge_page_bio\n- add_inu_page\n: cache page #2 into bio which is linked\nin io->bio_list\nwrite\n- f2fs_write_begin\n: write page #1\n- f2fs_folio_wait_writeback\n- f2fs_submit_merged_ipu_write\n- f2fs_submit_write_bio\n: submit bio which inclues page #1 and #2\nsoftware IRQ\n- f2fs_write_end_io\n- fscrypt_free_bounce_page\n: freed bounced page which belongs to page #2\n- inc_page_count( , WB_DATA_TYPE(data_folio), false)\n: data_folio points to fio->encrypted_page\nthe bounced page can be freed before\naccessing it in f2fs_is_cp_guarantee()\nIt can reproduce w/ below testcase:\nRun below script in shell #1:\nfor ((i=1;i>0;i++)) do xfs_io -f /mnt/f2fs/enc/file \\\n-c \"pwrite 0 32k\" -c \"fdatasync\"\nRun below script in shell #2:\nfor ((i=1;i>0;i++)) do xfs_io -f /mnt/f2fs/enc/file \\\n-c \"pwrite 0 32k\" -c \"fdatasync\"\nSo, in f2fs_merge_page_bio(), let's avoid using fio->encrypted_page after\ncommit page into internal ipu cache." ],
  "package_state" : [ {
    "product_name" : "Red Hat Enterprise Linux 10",
    "fix_state" : "Not affected",
    "package_name" : "kernel",
    "cpe" : "cpe:/o:redhat:enterprise_linux:10"
  }, {
    "product_name" : "Red Hat Enterprise Linux 6",
    "fix_state" : "Not affected",
    "package_name" : "kernel",
    "cpe" : "cpe:/o:redhat:enterprise_linux:6"
  }, {
    "product_name" : "Red Hat Enterprise Linux 7",
    "fix_state" : "Not affected",
    "package_name" : "kernel",
    "cpe" : "cpe:/o:redhat:enterprise_linux:7"
  }, {
    "product_name" : "Red Hat Enterprise Linux 7",
    "fix_state" : "Not affected",
    "package_name" : "kernel-rt",
    "cpe" : "cpe:/o:redhat:enterprise_linux:7"
  }, {
    "product_name" : "Red Hat Enterprise Linux 8",
    "fix_state" : "Not affected",
    "package_name" : "kernel",
    "cpe" : "cpe:/o:redhat:enterprise_linux:8"
  }, {
    "product_name" : "Red Hat Enterprise Linux 8",
    "fix_state" : "Not affected",
    "package_name" : "kernel-rt",
    "cpe" : "cpe:/o:redhat:enterprise_linux:8"
  }, {
    "product_name" : "Red Hat Enterprise Linux 9",
    "fix_state" : "Not affected",
    "package_name" : "kernel",
    "cpe" : "cpe:/o:redhat:enterprise_linux:9"
  }, {
    "product_name" : "Red Hat Enterprise Linux 9",
    "fix_state" : "Not affected",
    "package_name" : "kernel-rt",
    "cpe" : "cpe:/o:redhat:enterprise_linux:9"
  } ],
  "references" : [ "https://www.cve.org/CVERecord?id=CVE-2025-40054\nhttps://nvd.nist.gov/vuln/detail/CVE-2025-40054\nhttps://lore.kernel.org/linux-cve-announce/2025102815-CVE-2025-40054-c79b@gregkh/T" ],
  "name" : "CVE-2025-40054",
  "csaw" : false
}