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 A2F262E3B15 for ; Tue, 9 Dec 2025 01:32:58 +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=1765243978; cv=none; b=m51FAvEMZg6AcqV+hXKNNNVW85zXNelE9uzISnyHqi9jMTQgnBjHvygCxVQyPCPIaMIY1Qzij3DPXN+3EXxLLO2XJoDN9PIpQ/7AVQYq3lFFBxsJt5DgHjYMJIqGWTk9ZWLAer5dtmCydkyiC8DpwHt+88mR7zNMkSvHp6VFpeU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765243978; c=relaxed/simple; bh=vQuYwChw3+b7+bBc8NouSQFW+EoFv0Q85t8UDFN6pMY=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=c4EtyjblPRby6AmJKLau18NAvALKyFFfT5YpjTu5cZiH1q73vM3Qjo6yRQ9zhRtC0SBgY0BlGwCtW1pFtjMUHJDe8atPpdDg8B8FSDThjKBPrkBmhKBwbOXbelv6Oc53hWhLvTU3eQzZT/0CTywXkRgO35Bmh0AfJonukzbM+Kw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=vDfNwvwZ; 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="vDfNwvwZ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1C1BCC4CEF1; Tue, 9 Dec 2025 01:32:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1765243978; bh=vQuYwChw3+b7+bBc8NouSQFW+EoFv0Q85t8UDFN6pMY=; h=From:To:Cc:Subject:Date:Reply-To:From; b=vDfNwvwZtFyuSc2FH6cftmwJOLoPVwIU9oZg+6Tk1ibmNb4c1UC/p3Brlre9xUVxw Usa/RziHipOf/XtRIxTL6pb5wBAk9vawL6Eka0RsEPAVg48cBAPmixkR/UXhTdrHxa n8bmQFRPQGrA6EjcMBt9+v18/uMF3N3hdlQPuTH4= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2023-53846: f2fs: fix to do sanity check on direct node in truncate_dnode() Date: Tue, 9 Dec 2025 10:31:30 +0900 Message-ID: <2025120959-CVE-2023-53846-70c9@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=4114; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=ZqN8mdha7Q9oAoYg9rXYqmEp+Q0lb4gkv/VxM7+DL/4=; b=owGbwMvMwCRo6H6F97bub03G02pJDJnm1ZfflJ112aV5tFjKTH1SqEFsqdQufUvfykqWORLcb 7Pvb1zREcvCIMjEICumyPJlG8/R/RWHFL0MbU/DzGFlAhnCwMUpABOpzWFYsEHlxAb9p/oC0z49 eZb04uTVW8fznjPM92TwUDf58ib2v2HYisfO4kcesLSkAwA= 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 do sanity check on direct node in truncate_dnode() syzbot reports below bug: BUG: KASAN: slab-use-after-free in f2fs_truncate_data_blocks_range+0x122a/0x14c0 fs/f2fs/file.c:574 Read of size 4 at addr ffff88802a25c000 by task syz-executor148/5000 CPU: 1 PID: 5000 Comm: syz-executor148 Not tainted 6.4.0-rc7-syzkaller-00041-ge660abd551f1 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/27/2023 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xd9/0x150 lib/dump_stack.c:106 print_address_description.constprop.0+0x2c/0x3c0 mm/kasan/report.c:351 print_report mm/kasan/report.c:462 [inline] kasan_report+0x11c/0x130 mm/kasan/report.c:572 f2fs_truncate_data_blocks_range+0x122a/0x14c0 fs/f2fs/file.c:574 truncate_dnode+0x229/0x2e0 fs/f2fs/node.c:944 f2fs_truncate_inode_blocks+0x64b/0xde0 fs/f2fs/node.c:1154 f2fs_do_truncate_blocks+0x4ac/0xf30 fs/f2fs/file.c:721 f2fs_truncate_blocks+0x7b/0x300 fs/f2fs/file.c:749 f2fs_truncate.part.0+0x4a5/0x630 fs/f2fs/file.c:799 f2fs_truncate include/linux/fs.h:825 [inline] f2fs_setattr+0x1738/0x2090 fs/f2fs/file.c:1006 notify_change+0xb2c/0x1180 fs/attr.c:483 do_truncate+0x143/0x200 fs/open.c:66 handle_truncate fs/namei.c:3295 [inline] do_open fs/namei.c:3640 [inline] path_openat+0x2083/0x2750 fs/namei.c:3791 do_filp_open+0x1ba/0x410 fs/namei.c:3818 do_sys_openat2+0x16d/0x4c0 fs/open.c:1356 do_sys_open fs/open.c:1372 [inline] __do_sys_creat fs/open.c:1448 [inline] __se_sys_creat fs/open.c:1442 [inline] __x64_sys_creat+0xcd/0x120 fs/open.c:1442 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd The root cause is, inodeA references inodeB via inodeB's ino, once inodeA is truncated, it calls truncate_dnode() to truncate data blocks in inodeB's node page, it traverse mapping data from node->i.i_addr[0] to node->i.i_addr[ADDRS_PER_BLOCK() - 1], result in out-of-boundary access. This patch fixes to add sanity check on dnode page in truncate_dnode(), so that, it can help to avoid triggering such issue, and once it encounters such issue, it will record newly introduced ERROR_INVALID_NODE_REFERENCE error into superblock, later fsck can detect such issue and try repairing. Also, it removes f2fs_truncate_data_blocks() for cleanup due to the function has only one caller, and uses f2fs_truncate_data_blocks_range() instead. The Linux kernel CVE team has assigned CVE-2023-53846 to this issue. Affected and fixed versions =========================== Fixed in 6.4.10 with commit af0f716ad3b039cab9d426da63a5ee6c88751185 Fixed in 6.5 with commit a6ec83786ab9f13f25fb18166dee908845713a95 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-2023-53846 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/f2fs.h fs/f2fs/file.c fs/f2fs/node.c include/linux/f2fs_fs.h 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/af0f716ad3b039cab9d426da63a5ee6c88751185 https://git.kernel.org/stable/c/a6ec83786ab9f13f25fb18166dee908845713a95