# CVE-2024-41067: btrfs: scrub: handle RST lookup error correctly

CVE-2024-41067 is fixed in linux on 1 platform, first by DEBIAN-CVE-2024-41067, released July 29, 2024. It is not reported as exploited. Patch Radar priority: Routine.

- Web page: https://patchblox.com/security/cve/CVE-2024-41067
- Priority: Routine
- CVSS: 5.5 (Moderate)
- EPSS: 0.0020
- CISA KEV: not listed
- Exploited (vendor report): no
- Publicly disclosed: no
- Published: Jul 29, 2024
- Vendor advisory: https://msrc.microsoft.com/update-guide/vulnerability/CVE-2024-41067

## Description

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 scrub_read_endio():  	ASSERT(sector_nr < stripe->nr_sectors);  Before that, we would have tree dump from btrfs_get_raid_extent_offset(), as we failed to find the RST entry for the range.  [CAUSE] Inside scrub_submit_extent_sector_read() every time we allocated a new bbio we immediately called btrfs_map_block() to make sure there was some RST range covering the scrub target.  But if btrfs_map_block() fails, we immediately call endio for the bbio, while the bbio is newly allocated, it's completely empty.  Then inside scrub_read_endio(), 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 sector_nr == stripe->nr_sectors, triggering the ASSERT().  [FIX] Instead of calling btrfs_map_block() after allocating a new bbio, call btrfs_map_block() first.  Since our only objective of calling btrfs_map_block() is only to update stripe_len, there is really no need to do that after btrfs_alloc_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 pending_io, the scrub would never finish (since we didn't decrease the pending_io counter).  Although the root cause of RST lookup failure still needs to be addressed.

## Where it's fixed

| Platform | Product | Fixed in | Fix | Released |
|---|---|---|---|---|
| Linux | linux Debian 13.5 (trixie) | 6.9.11-1 | [DEBIAN-CVE-2024-41067](https://patchblox.com/security/data/fix/linux/debian-cve-2024-41067.md) | Jul 29, 2024 |
| Linux | linux Debian 14 | 6.9.11-1 | [DEBIAN-CVE-2024-41067](https://patchblox.com/security/data/fix/linux/debian-cve-2024-41067.md) | Jul 29, 2024 |

---

Data as of 2026-11-09T13:31:49Z UTC. Source: Patchblox Patch Radar (https://patchblox.com/security/patch-radar). Patchblox finds out-of-date software on Windows, macOS and Linux and updates it through release rings: https://patchblox.com/demo

Free to use with attribution: show "Data: Patchblox Patch Radar" with a link to https://patchblox.com/security/patch-radar. Terms, including what needs a written agreement: https://patchblox.com/security/patch-radar/use-the-data

Product names, logos and trademarks shown on Patch Radar belong to their respective owners. They are used only to identify the software each security fix applies to and to help readers find their platform. Their use does not imply any affiliation with, or endorsement by, those owners, and Patchblox is not affiliated with any of them.
