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 721C91C5D5A for ; Wed, 18 Jun 2025 11:05:00 +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=1750244700; cv=none; b=Gfo1BXWvPiSzQctcaj6WezYRCPZYr18njjVeRZPJahEMqUXDNb2VMOsga0QeR25A9Dx7Ex/fy90JVRukXEF8NEMW/GLSL9BuueRfvgGkgSUYcsRLWza6nMdCqdMLjbE20eurh6w4d5wT7Qw0l+pBwIiCzRtdXIJSG5zrj7Eh28c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750244700; c=relaxed/simple; bh=NDWrKT5rv5qZDWZeLDXoj/ZO6g8kY32wdZ59iAIFgJ0=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=VRdge1HwKJduW0h5kb31cdI5q6sjoYEzdOZWuUw2h0UHEKoqVoUcSUkr6CP3IXkKre0cS6iy4l5S7HROo623VMFovOqt0LflRG/YgqW50MWWHglKQdMoIDORI3FjF6oKKSzs4e5/EJQCtmORNUw/aLnJvxhUgpU+xKCvwkQ1H0A= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=y0PeOeSb; 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="y0PeOeSb" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A1217C4CEE7; Wed, 18 Jun 2025 11:04:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1750244700; bh=NDWrKT5rv5qZDWZeLDXoj/ZO6g8kY32wdZ59iAIFgJ0=; h=From:To:Cc:Subject:Date:Reply-to:From; b=y0PeOeSb1qvu3RGPOWqbnEKSdHJ44RKZmukBn6PRtxAmwXIxIxWnkU0C/F7NvQeZ4 2HxWrHOYlXwmM0pUfS69sfNBoJPtIjbw7PbydA2zbM9JNi237hdtedt0TXF85mID+Y Dv19GV5Fzi3fCw7A/HXv17W92WeCiaKwkIqx+V2w= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2022-50009: f2fs: fix null-ptr-deref in f2fs_get_dnode_of_data Date: Wed, 18 Jun 2025 13:01:14 +0200 Message-ID: <2025061831-CVE-2022-50009-214a@gregkh> X-Mailer: git-send-email 2.49.0 Precedence: bulk X-Mailing-List: linux-cve-announce@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Reply-to: , X-Developer-Signature: v=1; a=openpgp-sha256; l=3510; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=LlAnIH9EQtZTIEGbeSNaQ4HVm7Uwih0Bpp7ReT+Q+JU=; b=kA0DAAIRMUfUDdst+ykByyZiAGhSnE+jEk6r3j3nJOjvm06Ml/d5ZzMfC0zN6Mts6p9mAksDr ohdBAARAgAdFiEE9LYMxb94wiFKMT3LMUfUDdst+ykFAmhSnE8ACgkQMUfUDdst+ylqxgCeM19q XTZ6TEmv7CVX8QsLa1SU4HwAn0vaAIrH+inmozMuGTAzeWY3R95F 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 null-ptr-deref in f2fs_get_dnode_of_data There is issue as follows when test f2fs atomic write: F2FS-fs (loop0): Can't find valid F2FS filesystem in 2th superblock F2FS-fs (loop0): invalid crc_offset: 0 F2FS-fs (loop0): f2fs_check_nid_range: out-of-range nid=1, run fsck to fix. F2FS-fs (loop0): f2fs_check_nid_range: out-of-range nid=2, run fsck to fix. ================================================================== BUG: KASAN: null-ptr-deref in f2fs_get_dnode_of_data+0xac/0x16d0 Read of size 8 at addr 0000000000000028 by task rep/1990 CPU: 4 PID: 1990 Comm: rep Not tainted 5.19.0-rc6-next-20220715 #266 Call Trace: dump_stack_lvl+0x6e/0x91 print_report.cold+0x49a/0x6bb kasan_report+0xa8/0x130 f2fs_get_dnode_of_data+0xac/0x16d0 f2fs_do_write_data_page+0x2a5/0x1030 move_data_page+0x3c5/0xdf0 do_garbage_collect+0x2015/0x36c0 f2fs_gc+0x554/0x1d30 f2fs_balance_fs+0x7f5/0xda0 f2fs_write_single_data_page+0xb66/0xdc0 f2fs_write_cache_pages+0x716/0x1420 f2fs_write_data_pages+0x84f/0x9a0 do_writepages+0x130/0x3a0 filemap_fdatawrite_wbc+0x87/0xa0 file_write_and_wait_range+0x157/0x1c0 f2fs_do_sync_file+0x206/0x12d0 f2fs_sync_file+0x99/0xc0 vfs_fsync_range+0x75/0x140 f2fs_file_write_iter+0xd7b/0x1850 vfs_write+0x645/0x780 ksys_write+0xf1/0x1e0 do_syscall_64+0x3b/0x90 entry_SYSCALL_64_after_hwframe+0x63/0xcd As 3db1de0e582c commit changed atomic write way which new a cow_inode for atomic write file, and also mark cow_inode as FI_ATOMIC_FILE. When f2fs_do_write_data_page write cow_inode will use cow_inode's cow_inode which is NULL. Then will trigger null-ptr-deref. To solve above issue, introduce FI_COW_FILE flag for COW inode. Fiexes: 3db1de0e582c("f2fs: change the current atomic write way") The Linux kernel CVE team has assigned CVE-2022-50009 to this issue. Affected and fixed versions =========================== Fixed in 5.18.18 with commit 0f63e33eca6fa29a11c76fa31db5fe1cada5ad6e Fixed in 5.19.4 with commit 7000ad53ec1b17bd2fac76984b7b0c663755cbb7 Fixed in 6.0 with commit 4a2c5b7994960fac29cf8a3f4e62855bae1b27d4 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-2022-50009 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/segment.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/0f63e33eca6fa29a11c76fa31db5fe1cada5ad6e https://git.kernel.org/stable/c/7000ad53ec1b17bd2fac76984b7b0c663755cbb7 https://git.kernel.org/stable/c/4a2c5b7994960fac29cf8a3f4e62855bae1b27d4