{"id":"CVE-2025-38333","state":"PUBLISHED","title":"f2fs: fix to bail out in get_new_segment()","description":"In the Linux kernel, the following vulnerability has been resolved:\n\nf2fs: fix to bail out in get_new_segment()\n\n------------[ cut here ]------------\nWARNING: CPU: 3 PID: 579 at fs/f2fs/segment.c:2832 new_curseg+0x5e8/0x6dc\npc : new_curseg+0x5e8/0x6dc\nCall trace:\n new_curseg+0x5e8/0x6dc\n f2fs_allocate_data_block+0xa54/0xe28\n do_write_page+0x6c/0x194\n f2fs_do_write_node_page+0x38/0x78\n __write_node_page+0x248/0x6d4\n f2fs_sync_node_pages+0x524/0x72c\n f2fs_write_checkpoint+0x4bc/0x9b0\n __checkpoint_and_complete_reqs+0x80/0x244\n issue_checkpoint_thread+0x8c/0xec\n kthread+0x114/0x1bc\n ret_from_fork+0x10/0x20\n\nget_new_segment() detects inconsistent status in between free_segmap\nand free_secmap, let's record such error into super block, and bail\nout get_new_segment() instead of continue using the segment.","publishedAt":"2025-07-10T08:15:05.768Z","updatedAt":"2026-08-05T12:01:11.722Z","severity":{"score":7.8,"label":"High","version":"3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","source":"Linux"},"assigner":"Linux","products":["Linux Linux"],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"98e4da8ca301e062d79ae168c67e56f3c3de3ce4","status":"affected","lessThan":"f0023d7a2a86999c8e1300e911d92f995a5310a8","versionType":"git"},{"version":"98e4da8ca301e062d79ae168c67e56f3c3de3ce4","status":"affected","lessThan":"ca860f507a61c7c3d4dde47b830a5c0d555cf83c","versionType":"git"},{"version":"98e4da8ca301e062d79ae168c67e56f3c3de3ce4","status":"affected","lessThan":"bb5eb8a5b222fa5092f60d5555867a05ebc3bdf2","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["fs/f2fs/segment.c","include/linux/f2fs_fs.h"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"3.8","status":"affected"},{"version":"0","status":"unaffected","lessThan":"3.8","versionType":"semver"},{"version":"6.12.35","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.15.4","status":"unaffected","lessThanOrEqual":"6.15.*","versionType":"semver"},{"version":"6.16","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["fs/f2fs/segment.c","include/linux/f2fs_fs.h"]}],"references":["https://git.kernel.org/stable/c/f0023d7a2a86999c8e1300e911d92f995a5310a8","https://git.kernel.org/stable/c/ca860f507a61c7c3d4dde47b830a5c0d555cf83c","https://git.kernel.org/stable/c/bb5eb8a5b222fa5092f60d5555867a05ebc3bdf2"],"weaknesses":[],"ingestedAt":"2026-10-29T20:09:09.358Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2025/38xxx/CVE-2025-38333.json","commit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2025-38333","state":"PUBLISHED","datePublished":"2025-07-10T08:15:05.768Z","dateUpdated":"2026-08-05T12:01:11.722Z","assignerShortName":"Linux","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateReserved":"2025-04-16T04:51:24.005Z"},"containers":{"cna":{"title":"f2fs: fix to bail out in get_new_segment()","descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\nf2fs: fix to bail out in get_new_segment()\n\n------------[ cut here ]------------\nWARNING: CPU: 3 PID: 579 at fs/f2fs/segment.c:2832 new_curseg+0x5e8/0x6dc\npc : new_curseg+0x5e8/0x6dc\nCall trace:\n new_curseg+0x5e8/0x6dc\n f2fs_allocate_data_block+0xa54/0xe28\n do_write_page+0x6c/0x194\n f2fs_do_write_node_page+0x38/0x78\n __write_node_page+0x248/0x6d4\n f2fs_sync_node_pages+0x524/0x72c\n f2fs_write_checkpoint+0x4bc/0x9b0\n __checkpoint_and_complete_reqs+0x80/0x244\n issue_checkpoint_thread+0x8c/0xec\n kthread+0x114/0x1bc\n ret_from_fork+0x10/0x20\n\nget_new_segment() detects inconsistent status in between free_segmap\nand free_secmap, let's record such error into super block, and bail\nout get_new_segment() instead of continue using the segment."}],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"98e4da8ca301e062d79ae168c67e56f3c3de3ce4","status":"affected","lessThan":"f0023d7a2a86999c8e1300e911d92f995a5310a8","versionType":"git"},{"version":"98e4da8ca301e062d79ae168c67e56f3c3de3ce4","status":"affected","lessThan":"ca860f507a61c7c3d4dde47b830a5c0d555cf83c","versionType":"git"},{"version":"98e4da8ca301e062d79ae168c67e56f3c3de3ce4","status":"affected","lessThan":"bb5eb8a5b222fa5092f60d5555867a05ebc3bdf2","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["fs/f2fs/segment.c","include/linux/f2fs_fs.h"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"3.8","status":"affected"},{"version":"0","status":"unaffected","lessThan":"3.8","versionType":"semver"},{"version":"6.12.35","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.15.4","status":"unaffected","lessThanOrEqual":"6.15.*","versionType":"semver"},{"version":"6.16","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["fs/f2fs/segment.c","include/linux/f2fs_fs.h"]}],"references":[{"url":"https://git.kernel.org/stable/c/f0023d7a2a86999c8e1300e911d92f995a5310a8"},{"url":"https://git.kernel.org/stable/c/ca860f507a61c7c3d4dde47b830a5c0d555cf83c"},{"url":"https://git.kernel.org/stable/c/bb5eb8a5b222fa5092f60d5555867a05ebc3bdf2"}],"metrics":[{"cvssV3_1":{"version":"3.1","vectorString":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","baseScore":7.8,"baseSeverity":"HIGH"},"scenarios":[{"lang":"en","value":"AV:L - get_new_segment() is reached only through the f2fs allocator on a locally mounted volume — ordinary writes, fsync, GC, or the background checkpoint thread; there is no network-facing consumer of this code.\nAC:L - Once the free_segmap/free_secmap divergence exists — from attacker-supplied on-disk metadata on removable f2fs media or the in-kernel state divergence observed in the field — the condition is hit deterministically on the next allocation from that section, with no race window or memory layout the attacker must win.\nPR:L - On an already-mounted f2fs volume (Android /data, auto-mounted SD/USB), any unprivileged local user with write access drives segment allocation via normal file writes and fsync; no capability or CAP_SYS_ADMIN is needed for the trigger itself.\nUI:N - The reported failure fires on the background checkpoint kthread during ordinary operation on an already-mounted filesystem, and removable f2fs media are auto-mounted by vold/udisks2 without any action by another user.\nS:U - The corruption is confined to the kernel/f2fs security authority on the same host; no VM, IOMMU, or sandbox boundary is crossed.\nC:H - The already-in-use segment is handed out as a new current segment starting at block offset 0, so the same physical blocks become mapped by two different inodes and a reader of one file obtains blocks written for another user's file on a shared filesystem.\nI:H - Live data and node blocks belonging to other files are physically overwritten, SIT valid_blocks/cur_valid_map are corrupted, and the underflowed free_segments count is persisted into the on-disk checkpoint (ckpt->free_segment_count is never validated on read), so the damage survives reboot.\nA:H - With CONFIG_F2FS_CHECK_FS the f2fs_bug_on is a plain BUG_ON taken while holding free_i->segmap_lock on the checkpoint kthread — an immediate panic; otherwise the free_segments/free_sections underflow defeats GC accounting and the downstream f2fs_bug_on()s and -ENOSPC path end in f2fs_stop_checkpoint(), shutting the filesystem down."}]}],"providerMetadata":{"shortName":"Linux","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateUpdated":"2026-08-05T12:01:11.722Z"},"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"3.8","versionEndExcluding":"6.12.35"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"3.8","versionEndExcluding":"6.15.4"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"3.8","versionEndExcluding":"6.16"}]}]}],"x_generator":{"engine":"bippy-1.2.0"}}}}}