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 4B06416EC05 for ; Fri, 12 Jul 2024 12:33:37 +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=1720787617; cv=none; b=XaDaU20ppiPSLpuSP+cvTJj4VdWizIideRmE2dYqI+R4155KplHyT6XDtCkH5VYBi2cXZdtzxyfyUURNtzSeMGTzwDHAb3n/JgCLWYDZkMHtAr5H4gxQdVyuCz+08e4almE6FBXcQP1ec9rlWtBqcpr7jY/liuuUSXhHTGIMAt8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720787617; c=relaxed/simple; bh=wI3ygFZ9bfqMZwK5h6jjH70vGgh1giXL4sAQ3/HbvIA=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=DIkX4y7z82DS1C5EVRz/DbkiAkqNyaXLkS1eRK/FO0bkZRJBMCkPZigJo1xpnnDq96zNuUMW+3ApZfLVpWiMx9HTDRjWhYpCEpJHsLjqS3QxkPDe4CBl3k1VkvivlbpKiqsPqTslKKQcqVdS2pPTe7JEQpZW6Bh0Rx8qMS12a9s= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=itMgbX1Z; 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="itMgbX1Z" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C5B4DC32782; Fri, 12 Jul 2024 12:33:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1720787617; bh=wI3ygFZ9bfqMZwK5h6jjH70vGgh1giXL4sAQ3/HbvIA=; h=From:To:Cc:Subject:Date:Reply-to:From; b=itMgbX1Za6DrX5W6IztdvZMdM0Iv9D35b0TYQpGZuLimpT2X00AmD6//1zjDJgln+ qkg7TjWE0KfuSb5kf8+rDE5d2tJcOigZwGFY/PBQiMuyLNtj967UDTzUCIDfbsZvWe Ov4P7JWFY9yOuafGbH9IkJP8RuDy0rjb2hZb5Hh8= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2024-40952: ocfs2: fix NULL pointer dereference in ocfs2_journal_dirty() Date: Fri, 12 Jul 2024 14:32:28 +0200 Message-ID: <2024071223-CVE-2024-40952-4ed1@gregkh> X-Mailer: git-send-email 2.45.2 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=4835; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=wI3ygFZ9bfqMZwK5h6jjH70vGgh1giXL4sAQ3/HbvIA=; b=kA0DAAIRMUfUDdst+ykByyZiAGaRIlfIj09Ds/c6Z3VY3o2FrZ7yDstn0oYOS8a9qBqXgHQv0 IhdBAARAgAdFiEE9LYMxb94wiFKMT3LMUfUDdst+ykFAmaRIlcACgkQMUfUDdst+yly/ACeLKwc 1/cLAv59xJXYTI0sSBFKpLMAnR2Fz9/y6j76nolpr6pnMem3x6Jt X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: 8bit Description =========== In the Linux kernel, the following vulnerability has been resolved: ocfs2: fix NULL pointer dereference in ocfs2_journal_dirty() bdev->bd_super has been removed and commit 8887b94d9322 change the usage from bdev->bd_super to b_assoc_map->host->i_sb. This introduces the following NULL pointer dereference in ocfs2_journal_dirty() since b_assoc_map is still not initialized. This can be easily reproduced by running xfstests generic/186, which simulate no more credits. [ 134.351592] BUG: kernel NULL pointer dereference, address: 0000000000000000 ... [ 134.355341] RIP: 0010:ocfs2_journal_dirty+0x14f/0x160 [ocfs2] ... [ 134.365071] Call Trace: [ 134.365312] [ 134.365524] ? __die_body+0x1e/0x60 [ 134.365868] ? page_fault_oops+0x13d/0x4f0 [ 134.366265] ? __pfx_bit_wait_io+0x10/0x10 [ 134.366659] ? schedule+0x27/0xb0 [ 134.366981] ? exc_page_fault+0x6a/0x140 [ 134.367356] ? asm_exc_page_fault+0x26/0x30 [ 134.367762] ? ocfs2_journal_dirty+0x14f/0x160 [ocfs2] [ 134.368305] ? ocfs2_journal_dirty+0x13d/0x160 [ocfs2] [ 134.368837] ocfs2_create_new_meta_bhs.isra.51+0x139/0x2e0 [ocfs2] [ 134.369454] ocfs2_grow_tree+0x688/0x8a0 [ocfs2] [ 134.369927] ocfs2_split_and_insert.isra.67+0x35c/0x4a0 [ocfs2] [ 134.370521] ocfs2_split_extent+0x314/0x4d0 [ocfs2] [ 134.371019] ocfs2_change_extent_flag+0x174/0x410 [ocfs2] [ 134.371566] ocfs2_add_refcount_flag+0x3fa/0x630 [ocfs2] [ 134.372117] ocfs2_reflink_remap_extent+0x21b/0x4c0 [ocfs2] [ 134.372994] ? inode_update_timestamps+0x4a/0x120 [ 134.373692] ? __pfx_ocfs2_journal_access_di+0x10/0x10 [ocfs2] [ 134.374545] ? __pfx_ocfs2_journal_access_di+0x10/0x10 [ocfs2] [ 134.375393] ocfs2_reflink_remap_blocks+0xe4/0x4e0 [ocfs2] [ 134.376197] ocfs2_remap_file_range+0x1de/0x390 [ocfs2] [ 134.376971] ? security_file_permission+0x29/0x50 [ 134.377644] vfs_clone_file_range+0xfe/0x320 [ 134.378268] ioctl_file_clone+0x45/0xa0 [ 134.378853] do_vfs_ioctl+0x457/0x990 [ 134.379422] __x64_sys_ioctl+0x6e/0xd0 [ 134.379987] do_syscall_64+0x5d/0x170 [ 134.380550] entry_SYSCALL_64_after_hwframe+0x76/0x7e [ 134.381231] RIP: 0033:0x7fa4926397cb [ 134.381786] Code: 73 01 c3 48 8b 0d bd 56 38 00 f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 90 f3 0f 1e fa b8 10 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 8d 56 38 00 f7 d8 64 89 01 48 [ 134.383930] RSP: 002b:00007ffc2b39f7b8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 [ 134.384854] RAX: ffffffffffffffda RBX: 0000000000000004 RCX: 00007fa4926397cb [ 134.385734] RDX: 00007ffc2b39f7f0 RSI: 000000004020940d RDI: 0000000000000003 [ 134.386606] RBP: 0000000000000000 R08: 00111a82a4f015bb R09: 00007fa494221000 [ 134.387476] R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 [ 134.388342] R13: 0000000000f10000 R14: 0000558e844e2ac8 R15: 0000000000f10000 [ 134.389207] Fix it by only aborting transaction and journal in ocfs2_journal_dirty() now, and leave ocfs2_abort() later when detecting an aborted handle, e.g. start next transaction. Also log the handle details in this case. The Linux kernel CVE team has assigned CVE-2024-40952 to this issue. Affected and fixed versions =========================== Issue introduced in 6.6 with commit 8887b94d9322 and fixed in 6.6.36 with commit 0550ad87711f Issue introduced in 6.6 with commit 8887b94d9322 and fixed in 6.9.7 with commit 72663d3e0909 Issue introduced in 6.6 with commit 8887b94d9322 and fixed in 6.10-rc5 with commit 58f7e1e2c9e7 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-2024-40952 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/ocfs2/journal.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/0550ad87711f815b3d73e487ec58ca7d8f56edbc https://git.kernel.org/stable/c/72663d3e09091f431a0774227ca207c0358362dd https://git.kernel.org/stable/c/58f7e1e2c9e72c7974054c64c3abeac81c11f822