CVE-2023-53813

Source
https://nvd.nist.gov/vuln/detail/CVE-2023-53813
Import Source
https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2023-53813.json
JSON Data
https://api.test.osv.dev/v1/vulns/CVE-2023-53813
Downstream
Published
2025-12-09T00:01:10.886Z
Modified
2025-12-09T03:34:13.510437Z
Summary
ext4: fix rbtree traversal bug in ext4_mb_use_preallocated
Details

In the Linux kernel, the following vulnerability has been resolved:

ext4: fix rbtree traversal bug in ext4mbuse_preallocated

During allocations, while looking for preallocations(PA) in the per inode rbtree, we can't do a direct traversal of the tree because ext4mbdiscardgrouppreallocation() 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/

Database specific
{
    "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2023/53xxx/CVE-2023-53813.json",
    "cna_assigner": "Linux"
}
References

Affected packages

Git / git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git

Affected ranges

Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
3872778664e36528caf8b27f355e75482f6d562d
Fixed
339fee69a1daa71d6f97e47a867e2c32419a2406
Fixed
9d3de7ee192a6a253f475197fe4d2e2af10a731f

Affected versions

v6.*

v6.3
v6.3-rc4
v6.3-rc5
v6.3-rc6
v6.3-rc7
v6.4
v6.4-rc1
v6.4-rc2
v6.4-rc3
v6.4-rc4
v6.4-rc5
v6.4-rc6
v6.4-rc7
v6.4.1
v6.4.2
v6.4.3
v6.4.4
v6.4.5
v6.4.6
v6.4.7
v6.5-rc1

Database specific

source

"https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2023-53813.json"

Linux / Kernel

Package

Name
Kernel

Affected ranges

Type
ECOSYSTEM
Events
Introduced
6.4.0
Fixed
6.4.8

Database specific

source

"https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2023-53813.json"