Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B5571392C49 for ; Tue, 13 Jan 2026 15:30:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768318204; cv=none; b=RHXKKvnAOzMhVKSR8heGajFRrIPblq8GNzEHW8UtbPE7Q5xVj7d0e10jvDhpDI2MPxXYbPKHHTSuKud2oH2JSlJlfGvlKEdre0bQ7V/PHYISafIdvU8iuGhDCj8t32TwUyp8nVxLM3a+hApow7J5Qa0iKh+oP/WNOwYbE1UVUS8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768318204; c=relaxed/simple; bh=wdGUfxaFb8aw5gK7Pt7TrFOc3zO9vBMfvpEVz/K72JA=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=I5yY7rIDQ8OJs0eQojICB9PAlpA2T1ahD29aWrvyJtmbyT3q31GbPzXKk/zQUkApJRJeHU9x0k521FkqZC+z/LUnET/TM6wkvJtZEHFtQv+QD54dLptxNNtb5xx/UaFAGLkVR0PLJ5c8QajAi5V6d/9RIkD3fKyZY2/0jet9sZs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=VL4Qtt0G; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="VL4Qtt0G" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E4EBCC19424; Tue, 13 Jan 2026 15:30:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1768318204; bh=wdGUfxaFb8aw5gK7Pt7TrFOc3zO9vBMfvpEVz/K72JA=; h=From:To:Cc:Subject:Date:Reply-To:From; b=VL4Qtt0GNAwa4rtNPSkCB5lNifc9DLFaft3+fu6Tb8uivKlTbj27bpT7205NqEynT jMFHi+Yb7LlXhKqVyTCfvf8QFO5NT48PSCqc4arjr/RjnnHIgMYqXBDklva3H0frF2 ncWzZpnh3nCWqS6Lmx038TRhVUuTlXQOKxqK8hY0= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2025-68772: f2fs: fix to avoid updating compression context during writeback Date: Tue, 13 Jan 2026 16:28:58 +0100 Message-ID: <2026011358-CVE-2025-68772-9d70@gregkh> X-Mailer: git-send-email 2.52.0 Reply-To: , Precedence: bulk X-Mailing-List: linux-cve-announce@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=4729; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=PwWgvwWT0prJozInUPaC3YSkAWlPb1gD1jzsCIF6Zzk=; b=owGbwMvMwCRo6H6F97bub03G02pJDJlpKbsab/Faxp7cc22m045of/tb1114Vr3M7eMU/jybP /lHncy3jlgWBkEmBlkxRZYv23iO7q84pOhlaHsaZg4rE8gQBi5OAZgIcyvDHN5tzpz+jNNdO38V 31jzbeZt3V2xxxnmyhw5YdDw6vVujhi7mL7DG1RYAl9kAwA= X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: 8bit From: Greg Kroah-Hartman Description =========== In the Linux kernel, the following vulnerability has been resolved: f2fs: fix to avoid updating compression context during writeback Bai, Shuangpeng reported a bug as below: Oops: divide error: 0000 [#1] SMP KASAN PTI CPU: 0 UID: 0 PID: 11441 Comm: syz.0.46 Not tainted 6.17.0 #1 PREEMPT(full) Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014 RIP: 0010:f2fs_all_cluster_page_ready+0x106/0x550 fs/f2fs/compress.c:857 Call Trace: f2fs_write_cache_pages fs/f2fs/data.c:3078 [inline] __f2fs_write_data_pages fs/f2fs/data.c:3290 [inline] f2fs_write_data_pages+0x1c19/0x3600 fs/f2fs/data.c:3317 do_writepages+0x38e/0x640 mm/page-writeback.c:2634 filemap_fdatawrite_wbc mm/filemap.c:386 [inline] __filemap_fdatawrite_range mm/filemap.c:419 [inline] file_write_and_wait_range+0x2ba/0x3e0 mm/filemap.c:794 f2fs_do_sync_file+0x6e6/0x1b00 fs/f2fs/file.c:294 generic_write_sync include/linux/fs.h:3043 [inline] f2fs_file_write_iter+0x76e/0x2700 fs/f2fs/file.c:5259 new_sync_write fs/read_write.c:593 [inline] vfs_write+0x7e9/0xe00 fs/read_write.c:686 ksys_write+0x19d/0x2d0 fs/read_write.c:738 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xf7/0x470 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f The bug was triggered w/ below race condition: fsync setattr ioctl - f2fs_do_sync_file - file_write_and_wait_range - f2fs_write_cache_pages : inode is non-compressed : cc.cluster_size = F2FS_I(inode)->i_cluster_size = 0 - tag_pages_for_writeback - f2fs_setattr - truncate_setsize - f2fs_truncate - f2fs_fileattr_set - f2fs_setflags_common - set_compress_context : F2FS_I(inode)->i_cluster_size = 4 : set_inode_flag(inode, FI_COMPRESSED_FILE) - f2fs_compressed_file : return true - f2fs_all_cluster_page_ready : "pgidx % cc->cluster_size" trigger dividing 0 issue Let's change as below to fix this issue: - introduce a new atomic type variable .writeback in structure f2fs_inode_info to track the number of threads which calling f2fs_write_cache_pages(). - use .i_sem lock to protect .writeback update. - check .writeback before update compression context in f2fs_setflags_common() to avoid race w/ ->writepages. The Linux kernel CVE team has assigned CVE-2025-68772 to this issue. Affected and fixed versions =========================== Issue introduced in 5.6 with commit 4c8ff7095bef64fc47e996a938f7d57f9e077da3 and fixed in 6.1.160 with commit ad26bfbc085c939b5dca77ff8c14798c06d151c4 Issue introduced in 5.6 with commit 4c8ff7095bef64fc47e996a938f7d57f9e077da3 and fixed in 6.6.120 with commit bcd0086ee5a2e88c1224ff2ec1e4a43c83efe5a0 Issue introduced in 5.6 with commit 4c8ff7095bef64fc47e996a938f7d57f9e077da3 and fixed in 6.12.64 with commit 0bf1a02494c7eb5bd43445de4c83c8592e02c4bf Issue introduced in 5.6 with commit 4c8ff7095bef64fc47e996a938f7d57f9e077da3 and fixed in 6.18.3 with commit 0df713a9c082a474c8b0bcf670edc8e98461d5a0 Issue introduced in 5.6 with commit 4c8ff7095bef64fc47e996a938f7d57f9e077da3 and fixed in 6.19-rc1 with commit 10b591e7fb7cdc8c1e53e9c000dc0ef7069aaa76 Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community. Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at https://cve.org/CVERecord/?id=CVE-2025-68772 will be updated if fixes are backported, please check that for the most up to date information about this issue. Affected files ============== The file(s) affected by this issue are: fs/f2fs/data.c fs/f2fs/f2fs.h fs/f2fs/file.c fs/f2fs/super.c Mitigation ========== The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits: https://git.kernel.org/stable/c/ad26bfbc085c939b5dca77ff8c14798c06d151c4 https://git.kernel.org/stable/c/bcd0086ee5a2e88c1224ff2ec1e4a43c83efe5a0 https://git.kernel.org/stable/c/0bf1a02494c7eb5bd43445de4c83c8592e02c4bf https://git.kernel.org/stable/c/0df713a9c082a474c8b0bcf670edc8e98461d5a0 https://git.kernel.org/stable/c/10b591e7fb7cdc8c1e53e9c000dc0ef7069aaa76