CVE-2024-41067

Source
https://nvd.nist.gov/vuln/detail/CVE-2024-41067
Import Source
https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2024-41067.json
JSON Data
https://api.osv.dev/v1/vulns/CVE-2024-41067
Downstream
Published
2024-07-29T14:57:28.543Z
Modified
2026-01-05T23:09:52.788260Z
Summary
btrfs: scrub: handle RST lookup error correctly
Details

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

btrfs: scrub: handle RST lookup error correctly

[BUG] When running btrfs/060 with forced RST feature, it would crash the following ASSERT() inside scrubreadendio():

ASSERT(sector_nr < stripe->nr_sectors);

Before that, we would have tree dump from btrfsgetraidextentoffset(), as we failed to find the RST entry for the range.

[CAUSE] Inside scrubsubmitextentsectorread() every time we allocated a new bbio we immediately called btrfsmapblock() to make sure there was some RST range covering the scrub target.

But if btrfsmapblock() fails, we immediately call endio for the bbio, while the bbio is newly allocated, it's completely empty.

Then inside scrubreadendio(), we go through the bvecs to find the sector number (as bi_sector is no longer reliable if the bio is submitted to lower layers).

And since the bio is empty, such bvecs iteration would not find any sector matching the sector, and return sectornr == stripe->nrsectors, triggering the ASSERT().

[FIX] Instead of calling btrfsmapblock() after allocating a new bbio, call btrfsmapblock() first.

Since our only objective of calling btrfsmapblock() is only to update stripelen, there is really no need to do that after btrfsalloc_bio().

This new timing would avoid the problem of handling empty bbio completely, and in fact fixes a possible race window for the old code, where if the submission thread is the only owner of the pendingio, the scrub would never finish (since we didn't decrease the pendingio counter).

Although the root cause of RST lookup failure still needs to be addressed.

Database specific
{
    "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2024/41xxx/CVE-2024-41067.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
9acaa64187f9b4cbb75622883c96ea1a893d5431
Fixed
17d1fd302a53d7e456a7412da74be74a0cf63a72
Fixed
2c49908634a2b97b1c3abe0589be2739ac5e7fd5

Affected versions

v6.*

v6.6
v6.6-rc6
v6.6-rc7
v6.7
v6.7-rc1
v6.7-rc2
v6.7-rc3
v6.7-rc4
v6.7-rc5
v6.7-rc6
v6.7-rc7
v6.7-rc8
v6.8
v6.8-rc1
v6.8-rc2
v6.8-rc3
v6.8-rc4
v6.8-rc5
v6.8-rc6
v6.8-rc7
v6.9
v6.9-rc1
v6.9-rc2
v6.9-rc3
v6.9-rc4
v6.9-rc5
v6.9-rc6
v6.9-rc7
v6.9.1
v6.9.10
v6.9.2
v6.9.3
v6.9.4
v6.9.5
v6.9.6
v6.9.7
v6.9.8
v6.9.9

Database specific

source

"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2024-41067.json"

Linux / Kernel

Package

Name
Kernel

Affected ranges

Type
ECOSYSTEM
Events
Introduced
6.7.0
Fixed
6.9.11

Database specific

source

"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2024-41067.json"