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 C4637BA3D for ; Tue, 9 Dec 2025 00:04:40 +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=1765238680; cv=none; b=tuuGKvi2s5b701d46YQL1vkNqbJr1/jF09/H0a1D2gbI4z6azpQphc5y6ALGwYf7NDfoF8XuzdI7jyJKGth6V769r8vjHTuMkbfAzKSk2yaLlg6m9dfrYL8uBWbP6k2ajEi89K352okdJweYBvT6/9N3F8E4CoYMqGs38dbi6qM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765238680; c=relaxed/simple; bh=KSWAQF8fHNDIFC8LPAYUV+E844JFUp+ks3YLyGMikJI=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=Xzg/G1JRX7LM25d25IqWQy5XZ4MC+GSMZ7HYF6trr4b5DS4yVB4vkoBphzYOGynKGRh4KNFfrK1JjjPdfPBnldw8H3DoYoahlF/trA0tOuXJtCBds/uVZqLudCl9HJcpg9XbcNFhCBERQZ+6shqr/zAv2NpVsX8P45SMBhRfPHs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=slYN15Ek; 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="slYN15Ek" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 64444C4CEF1; Tue, 9 Dec 2025 00:04:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1765238680; bh=KSWAQF8fHNDIFC8LPAYUV+E844JFUp+ks3YLyGMikJI=; h=From:To:Cc:Subject:Date:Reply-To:From; b=slYN15EkG07KltfxE5F1TTR/Hhc8g3uN3vN4Q9MQmaMqO5AtT7/mmijlE1PfjGrtP BpPUut0v4CqR7uKgkD7tb9BziLQA7jwu8sZasSUVpuH2IoxnBQzAh+F4Z/vg4uDNTe 29N4UNVjz+gJECpFSrtBmnDYJrF7ghQm5zJJ9UPs= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2023-53813: ext4: fix rbtree traversal bug in ext4_mb_use_preallocated Date: Tue, 9 Dec 2025 09:02:34 +0900 Message-ID: <2025120944-CVE-2023-53813-cd16@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=3450; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=dMdkAMtNwmP/jvb0bya9NIoFRYf+3r8hMRJx0EkfeCM=; b=owGbwMvMwCRo6H6F97bub03G02pJDJnmaS/+aa5h137BzxBWJuNXs2T9u5mxnuHRzgyumo2ia XUqzms7YlkYBJkYZMUUWb5s4zm6v+KQopeh7WmYOaxMIEMYuDgFYCKf7zDMU9v//7xBm4yCj6Tp jx237BavFdM3Y1hwWdxh3V0useeCrGtELe3kr6XXcPEBAA== 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: ext4: fix rbtree traversal bug in ext4_mb_use_preallocated During allocations, while looking for preallocations(PA) in the per inode rbtree, we can't do a direct traversal of the tree because ext4_mb_discard_group_preallocation() can paralelly mark the pa deleted and that can cause direct traversal to skip some entries. This was leading to a BUG_ON() being hit [1] when we missed a PA that could satisfy our request and ultimately tried to create a new PA that would overlap with the missed one. To makes sure we handle that case while still keeping the performance of the rbtree, we make use of the fact that the only pa that could possibly overlap the original goal start is the one that satisfies the below conditions: 1. It must have it's logical start immediately to the left of (ie less than) original logical start. 2. It must not be deleted To find this pa we use the following traversal method: 1. Descend into the rbtree normally to find the immediate neighboring PA. Here we keep descending irrespective of if the PA is deleted or if it overlaps with our request etc. The goal is to find an immediately adjacent PA. 2. If the found PA is on right of original goal, use rb_prev() to find the left adjacent PA. 3. Check if this PA is deleted and keep moving left with rb_prev() until a non deleted PA is found. 4. This is the PA we are looking for. Now we can check if it can satisfy the original request and proceed accordingly. This approach also takes care of having deleted PAs in the tree. (While we are at it, also fix a possible overflow bug in calculating the end of a PA) [1] https://lore.kernel.org/linux-ext4/CA+G9fYv2FRpLqBZf34ZinR8bU2_ZRAUOjKAD3+tKRFaEQHtt8Q@mail.gmail.com/ The Linux kernel CVE team has assigned CVE-2023-53813 to this issue. Affected and fixed versions =========================== Issue introduced in 6.4 with commit 3872778664e36528caf8b27f355e75482f6d562d and fixed in 6.4.8 with commit 339fee69a1daa71d6f97e47a867e2c32419a2406 Issue introduced in 6.4 with commit 3872778664e36528caf8b27f355e75482f6d562d and fixed in 6.5 with commit 9d3de7ee192a6a253f475197fe4d2e2af10a731f 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-53813 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/ext4/mballoc.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/339fee69a1daa71d6f97e47a867e2c32419a2406 https://git.kernel.org/stable/c/9d3de7ee192a6a253f475197fe4d2e2af10a731f