{"api_version":"1","generated_at":"2026-12-02T08:20:48+00:00","cve":"CVE-2026-139012","urls":{"html":"https://cve.report/CVE-2026-139012","api":"https://cve.report/api/cve/CVE-2026-139012.json","docs":"https://cve.report/api","cve_org":"https://www.cve.org/CVERecord?id=CVE-2026-139012","nvd":"https://nvd.nist.gov/vuln/detail/CVE-2026-139012"},"summary":{"title":"f2fs: compress: fix to handle race between truncate and writeback","description":"In the Linux kernel, the following vulnerability has been resolved:\n\nf2fs: compress: fix to handle race between truncate and writeback\n\nfsstress reports a kernel BUG in f2fs_truncate_partial_cluster():\n\nkernel BUG at fs/f2fs/compress.c:1238!\nRIP: 0010:f2fs_truncate_partial_cluster+0x292/0x2a0\nCall Trace:\n <TASK>\n f2fs_truncate+0xf6/0x210\n f2fs_setattr+0x6b7/0x770\n notify_change+0x33b/0x520\n do_truncate+0xc2/0xf0\n vfs_truncate+0x153/0x1d0\n ksys_truncate+0x78/0xd0\n __x64_sys_truncate+0x16/0x20\n do_syscall_64+0xbe/0x540\n\nThe root cause is that Thread A (truncate) and Thread B (background\nwriteback or fsync) can race as follows:\n\nThread A                             Thread B\n- f2fs_setattr\n - f2fs_truncate\n  - f2fs_truncate_blocks\n   - f2fs_truncate_partial_cluster\n    - f2fs_is_compressed_cluster\n      return 1\n                                     - f2fs_write_cache_pages\n                                      - f2fs_write_multi_pages\n                                       - f2fs_write_raw_pages\n                                        - f2fs_write_single_data_page\n                                          dn.data_blkaddr != COMPRESS_ADDR\n                                          (cluster converted to normal)\n    - f2fs_prepare_compress_overwrite\n     - f2fs_is_compressed_cluster\n       return 0\n     - return 0\n    - f2fs_bug_on(sbi, err == 0): BUG!\n\nWriteback path does not acquire i_gc_rwsem or filemap_invalidate_lock.\nWhen a compressed cluster fails compression during writeback, it is\noverwritten with raw data blocks. If Thread A checked\nf2fs_is_compressed_cluster() before the conversion, but calls\nf2fs_prepare_compress_overwrite() after the conversion,\nf2fs_prepare_compress_overwrite() returns 0 because the cluster is no\nlonger a compressed cluster.\n\nTo fix this, remove the f2fs_bug_on() and retry checking the cluster status\nwhen f2fs_prepare_compress_overwrite() returns 0, so that it can fall back\nto f2fs_do_truncate_blocks() to handle it as a normal cluster.","state":"PUBLISHED","assigner":"Linux","published_at":"2026-11-30 14:18:04","updated_at":"2026-11-30 14:18:04"},"problem_types":[],"metrics":[],"references":[{"url":"https://git.kernel.org/stable/c/c25c023fb531baf5e8ca57f2211aff6292506210","name":"https://git.kernel.org/stable/c/c25c023fb531baf5e8ca57f2211aff6292506210","refsource":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","tags":[],"title":"","mime":"","httpstatus":"","archivestatus":"0"},{"url":"https://git.kernel.org/stable/c/c0d77acef537dd3f0b1dcf94c9d0a265936d4ba6","name":"https://git.kernel.org/stable/c/c0d77acef537dd3f0b1dcf94c9d0a265936d4ba6","refsource":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","tags":[],"title":"","mime":"","httpstatus":"","archivestatus":"0"},{"url":"https://git.kernel.org/stable/c/3e82f85a40e71c0023408994f600fe862b83688d","name":"https://git.kernel.org/stable/c/3e82f85a40e71c0023408994f600fe862b83688d","refsource":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","tags":[],"title":"","mime":"","httpstatus":"","archivestatus":"0"},{"url":"https://git.kernel.org/stable/c/305021c93f4457c56d899e858742860df7bf0b8b","name":"https://git.kernel.org/stable/c/305021c93f4457c56d899e858742860df7bf0b8b","refsource":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","tags":[],"title":"","mime":"","httpstatus":"","archivestatus":"0"},{"url":"https://git.kernel.org/stable/c/9c7b917ffdf4be38d7074ddc23a39b4fe23dc1f7","name":"https://git.kernel.org/stable/c/9c7b917ffdf4be38d7074ddc23a39b4fe23dc1f7","refsource":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","tags":[],"title":"","mime":"","httpstatus":"","archivestatus":"0"},{"url":"https://git.kernel.org/stable/c/06e413468900775563b4c87169e28912c1855d30","name":"https://git.kernel.org/stable/c/06e413468900775563b4c87169e28912c1855d30","refsource":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","tags":[],"title":"","mime":"","httpstatus":"","archivestatus":"0"},{"url":"https://git.kernel.org/stable/c/3eae9d491339330d15c5a99e701d09646fb6e85c","name":"https://git.kernel.org/stable/c/3eae9d491339330d15c5a99e701d09646fb6e85c","refsource":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","tags":[],"title":"","mime":"","httpstatus":"","archivestatus":"0"},{"url":"https://git.kernel.org/stable/c/c0337e331b065074ce20e4258a578e07dd7e4083","name":"https://git.kernel.org/stable/c/c0337e331b065074ce20e4258a578e07dd7e4083","refsource":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","tags":[],"title":"","mime":"","httpstatus":"","archivestatus":"0"},{"url":"https://www.cve.org/CVERecord?id=CVE-2026-139012","name":"CVE Program record","refsource":"CVE.ORG","tags":["canonical"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-139012","name":"NVD vulnerability detail","refsource":"NVD","tags":["canonical","analysis"]}],"affected":[{"source":"CNA","vendor":"Linux","product":"Linux","version":"affected 3265d3db1f16395cfc6b8ea9b31b4001d98d05ef 3eae9d491339330d15c5a99e701d09646fb6e85c git","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"affected 3265d3db1f16395cfc6b8ea9b31b4001d98d05ef c25c023fb531baf5e8ca57f2211aff6292506210 git","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"affected 3265d3db1f16395cfc6b8ea9b31b4001d98d05ef 9c7b917ffdf4be38d7074ddc23a39b4fe23dc1f7 git","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"affected 3265d3db1f16395cfc6b8ea9b31b4001d98d05ef 06e413468900775563b4c87169e28912c1855d30 git","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"affected 3265d3db1f16395cfc6b8ea9b31b4001d98d05ef 305021c93f4457c56d899e858742860df7bf0b8b git","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"affected 3265d3db1f16395cfc6b8ea9b31b4001d98d05ef c0d77acef537dd3f0b1dcf94c9d0a265936d4ba6 git","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"affected 3265d3db1f16395cfc6b8ea9b31b4001d98d05ef 3e82f85a40e71c0023408994f600fe862b83688d git","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"affected 3265d3db1f16395cfc6b8ea9b31b4001d98d05ef c0337e331b065074ce20e4258a578e07dd7e4083 git","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"affected 5.8","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"unaffected 5.8 semver","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"unaffected 5.10.275 5.10.* semver","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"unaffected 5.15.226 5.15.* semver","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"unaffected 6.1.193 6.1.* semver","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"unaffected 6.6.163 6.6.* semver","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"unaffected 6.12.117 6.12.* semver","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"unaffected 6.18.63 6.18.* semver","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"unaffected 7.3.4 7.3.* semver","platforms":[]},{"source":"CNA","vendor":"Linux","product":"Linux","version":"unaffected 7.4-rc1 * original_commit_for_fix","platforms":[]}],"timeline":[],"solutions":[],"workarounds":[],"exploits":[],"credits":[],"nvd_cpes":[],"vendor_comments":[],"enrichments":{"kev":null,"epss":null,"legacy_qids":[]},"source_records":{"cve_program":{"containers":{"cna":{"affected":[{"defaultStatus":"unaffected","product":"Linux","programFiles":["fs/f2fs/compress.c"],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","vendor":"Linux","versions":[{"lessThan":"3eae9d491339330d15c5a99e701d09646fb6e85c","status":"affected","version":"3265d3db1f16395cfc6b8ea9b31b4001d98d05ef","versionType":"git"},{"lessThan":"c25c023fb531baf5e8ca57f2211aff6292506210","status":"affected","version":"3265d3db1f16395cfc6b8ea9b31b4001d98d05ef","versionType":"git"},{"lessThan":"9c7b917ffdf4be38d7074ddc23a39b4fe23dc1f7","status":"affected","version":"3265d3db1f16395cfc6b8ea9b31b4001d98d05ef","versionType":"git"},{"lessThan":"06e413468900775563b4c87169e28912c1855d30","status":"affected","version":"3265d3db1f16395cfc6b8ea9b31b4001d98d05ef","versionType":"git"},{"lessThan":"305021c93f4457c56d899e858742860df7bf0b8b","status":"affected","version":"3265d3db1f16395cfc6b8ea9b31b4001d98d05ef","versionType":"git"},{"lessThan":"c0d77acef537dd3f0b1dcf94c9d0a265936d4ba6","status":"affected","version":"3265d3db1f16395cfc6b8ea9b31b4001d98d05ef","versionType":"git"},{"lessThan":"3e82f85a40e71c0023408994f600fe862b83688d","status":"affected","version":"3265d3db1f16395cfc6b8ea9b31b4001d98d05ef","versionType":"git"},{"lessThan":"c0337e331b065074ce20e4258a578e07dd7e4083","status":"affected","version":"3265d3db1f16395cfc6b8ea9b31b4001d98d05ef","versionType":"git"}]},{"defaultStatus":"affected","product":"Linux","programFiles":["fs/f2fs/compress.c"],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","vendor":"Linux","versions":[{"status":"affected","version":"5.8"},{"lessThan":"5.8","status":"unaffected","version":"0","versionType":"semver"},{"lessThanOrEqual":"5.10.*","status":"unaffected","version":"5.10.275","versionType":"semver"},{"lessThanOrEqual":"5.15.*","status":"unaffected","version":"5.15.226","versionType":"semver"},{"lessThanOrEqual":"6.1.*","status":"unaffected","version":"6.1.193","versionType":"semver"},{"lessThanOrEqual":"6.6.*","status":"unaffected","version":"6.6.163","versionType":"semver"},{"lessThanOrEqual":"6.12.*","status":"unaffected","version":"6.12.117","versionType":"semver"},{"lessThanOrEqual":"6.18.*","status":"unaffected","version":"6.18.63","versionType":"semver"},{"lessThanOrEqual":"7.3.*","status":"unaffected","version":"7.3.4","versionType":"semver"},{"lessThanOrEqual":"*","status":"unaffected","version":"7.4-rc1","versionType":"original_commit_for_fix"}]}],"cpeApplicability":[{"nodes":[{"cpeMatch":[{"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionEndExcluding":"5.10.275","versionStartIncluding":"5.8","vulnerable":true},{"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionEndExcluding":"5.15.226","versionStartIncluding":"5.8","vulnerable":true},{"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionEndExcluding":"6.1.193","versionStartIncluding":"5.8","vulnerable":true},{"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionEndExcluding":"6.6.163","versionStartIncluding":"5.8","vulnerable":true},{"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionEndExcluding":"6.12.117","versionStartIncluding":"5.8","vulnerable":true},{"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionEndExcluding":"6.18.63","versionStartIncluding":"5.8","vulnerable":true},{"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionEndExcluding":"7.3.4","versionStartIncluding":"5.8","vulnerable":true},{"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionEndExcluding":"7.4-rc1","versionStartIncluding":"5.8","vulnerable":true}],"negate":false,"operator":"OR"}]}],"descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\nf2fs: compress: fix to handle race between truncate and writeback\n\nfsstress reports a kernel BUG in f2fs_truncate_partial_cluster():\n\nkernel BUG at fs/f2fs/compress.c:1238!\nRIP: 0010:f2fs_truncate_partial_cluster+0x292/0x2a0\nCall Trace:\n <TASK>\n f2fs_truncate+0xf6/0x210\n f2fs_setattr+0x6b7/0x770\n notify_change+0x33b/0x520\n do_truncate+0xc2/0xf0\n vfs_truncate+0x153/0x1d0\n ksys_truncate+0x78/0xd0\n __x64_sys_truncate+0x16/0x20\n do_syscall_64+0xbe/0x540\n\nThe root cause is that Thread A (truncate) and Thread B (background\nwriteback or fsync) can race as follows:\n\nThread A                             Thread B\n- f2fs_setattr\n - f2fs_truncate\n  - f2fs_truncate_blocks\n   - f2fs_truncate_partial_cluster\n    - f2fs_is_compressed_cluster\n      return 1\n                                     - f2fs_write_cache_pages\n                                      - f2fs_write_multi_pages\n                                       - f2fs_write_raw_pages\n                                        - f2fs_write_single_data_page\n                                          dn.data_blkaddr != COMPRESS_ADDR\n                                          (cluster converted to normal)\n    - f2fs_prepare_compress_overwrite\n     - f2fs_is_compressed_cluster\n       return 0\n     - return 0\n    - f2fs_bug_on(sbi, err == 0): BUG!\n\nWriteback path does not acquire i_gc_rwsem or filemap_invalidate_lock.\nWhen a compressed cluster fails compression during writeback, it is\noverwritten with raw data blocks. If Thread A checked\nf2fs_is_compressed_cluster() before the conversion, but calls\nf2fs_prepare_compress_overwrite() after the conversion,\nf2fs_prepare_compress_overwrite() returns 0 because the cluster is no\nlonger a compressed cluster.\n\nTo fix this, remove the f2fs_bug_on() and retry checking the cluster status\nwhen f2fs_prepare_compress_overwrite() returns 0, so that it can fall back\nto f2fs_do_truncate_blocks() to handle it as a normal cluster."}],"providerMetadata":{"dateUpdated":"2026-11-30T13:27:03.397Z","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","shortName":"Linux"},"references":[{"url":"https://git.kernel.org/stable/c/3eae9d491339330d15c5a99e701d09646fb6e85c"},{"url":"https://git.kernel.org/stable/c/c25c023fb531baf5e8ca57f2211aff6292506210"},{"url":"https://git.kernel.org/stable/c/9c7b917ffdf4be38d7074ddc23a39b4fe23dc1f7"},{"url":"https://git.kernel.org/stable/c/06e413468900775563b4c87169e28912c1855d30"},{"url":"https://git.kernel.org/stable/c/305021c93f4457c56d899e858742860df7bf0b8b"},{"url":"https://git.kernel.org/stable/c/c0d77acef537dd3f0b1dcf94c9d0a265936d4ba6"},{"url":"https://git.kernel.org/stable/c/3e82f85a40e71c0023408994f600fe862b83688d"},{"url":"https://git.kernel.org/stable/c/c0337e331b065074ce20e4258a578e07dd7e4083"}],"title":"f2fs: compress: fix to handle race between truncate and writeback","x_generator":{"engine":"bippy-1.2.0"}}},"cveMetadata":{"assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","assignerShortName":"Linux","cveId":"CVE-2026-139012","datePublished":"2026-11-30T13:27:03.397Z","dateReserved":"2026-11-30T13:22:15.909Z","dateUpdated":"2026-11-30T13:27:03.397Z","state":"PUBLISHED"},"dataType":"CVE_RECORD","dataVersion":"5.2"},"nvd":{"publishedDate":"2026-11-30 14:18:04","lastModifiedDate":"2026-11-30 14:18:04","problem_types":[],"metrics":[],"configurations":[]},"legacy_mitre":{"record":{"CveYear":"2026","CveId":"139012","Ordinal":"1","Title":"f2fs: compress: fix to handle race between truncate and writebac","CVE":"CVE-2026-139012","Year":"2026"},"notes":[{"CveYear":"2026","CveId":"139012","Ordinal":"1","NoteData":"In the Linux kernel, the following vulnerability has been resolved:\n\nf2fs: compress: fix to handle race between truncate and writeback\n\nfsstress reports a kernel BUG in f2fs_truncate_partial_cluster():\n\nkernel BUG at fs/f2fs/compress.c:1238!\nRIP: 0010:f2fs_truncate_partial_cluster+0x292/0x2a0\nCall Trace:\n <TASK>\n f2fs_truncate+0xf6/0x210\n f2fs_setattr+0x6b7/0x770\n notify_change+0x33b/0x520\n do_truncate+0xc2/0xf0\n vfs_truncate+0x153/0x1d0\n ksys_truncate+0x78/0xd0\n __x64_sys_truncate+0x16/0x20\n do_syscall_64+0xbe/0x540\n\nThe root cause is that Thread A (truncate) and Thread B (background\nwriteback or fsync) can race as follows:\n\nThread A                             Thread B\n- f2fs_setattr\n - f2fs_truncate\n  - f2fs_truncate_blocks\n   - f2fs_truncate_partial_cluster\n    - f2fs_is_compressed_cluster\n      return 1\n                                     - f2fs_write_cache_pages\n                                      - f2fs_write_multi_pages\n                                       - f2fs_write_raw_pages\n                                        - f2fs_write_single_data_page\n                                          dn.data_blkaddr != COMPRESS_ADDR\n                                          (cluster converted to normal)\n    - f2fs_prepare_compress_overwrite\n     - f2fs_is_compressed_cluster\n       return 0\n     - return 0\n    - f2fs_bug_on(sbi, err == 0): BUG!\n\nWriteback path does not acquire i_gc_rwsem or filemap_invalidate_lock.\nWhen a compressed cluster fails compression during writeback, it is\noverwritten with raw data blocks. If Thread A checked\nf2fs_is_compressed_cluster() before the conversion, but calls\nf2fs_prepare_compress_overwrite() after the conversion,\nf2fs_prepare_compress_overwrite() returns 0 because the cluster is no\nlonger a compressed cluster.\n\nTo fix this, remove the f2fs_bug_on() and retry checking the cluster status\nwhen f2fs_prepare_compress_overwrite() returns 0, so that it can fall back\nto f2fs_do_truncate_blocks() to handle it as a normal cluster.","Type":"Description","Title":"f2fs: compress: fix to handle race between truncate and writebac"}]}}}