# CVE-2024-50118: btrfs: reject ro-\>rw reconfiguration if there are hard ro requirements

> Archived entry. Full-text search covers entries since 2026-11-10; exact IDs work for all years.

- **Severity:** MEDIUM 5.5
- **CVSS:** 5.5 (v3.1, CNA) `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H`
- **CVSS metrics:** Attack vector: Local; Attack complexity: Low; Privileges required: Low; User interaction: None; Scope: Unchanged; Confidentiality impact: None; Integrity impact: None; Availability impact: High
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Not remotely exploitable (local or adjacent access needed)
- **EPSS:** 0.26% (percentile 11, 2026-11-26)
- **CWE:** CWE-476
- **Published:** 2024-11-05T17:10:48.641Z
- **Modified:** 2026-06-17T08:03:38.137Z

## Who should check

- Anyone running Linux \>= f044b318675f0347ecfb88377542651ba4eb9e1f, \< 23724398b55d9570f6ae79dd2ea026fff8896bf1; \>= f044b318675f0347ecfb88377542651ba4eb9e1f, \< 3c36a72c1d27de6618c1c480c793d9924640f5bb
- Anyone running Linux 6.8

## Description

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

btrfs: reject ro-\>rw reconfiguration if there are hard ro requirements

\[BUG\]
Syzbot reports the following crash:

  BTRFS info (device loop0 state MCS): disabling free space tree
  BTRFS info (device loop0 state MCS): clearing compat-ro feature flag for FREE\_SPACE\_TREE (0x1)
  BTRFS info (device loop0 state MCS): clearing compat-ro feature flag for FREE\_SPACE\_TREE\_VALID (0x2)
  Oops: general protection fault, probably for non-canonical address 0xdffffc0000000003: 0000 \[\#1\] PREEMPT SMP KASAN NOPTI
  KASAN: null-ptr-deref in range \[0x0000000000000018-0x000000000000001f\]
  Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014
  RIP: 0010:backup\_super\_roots fs/btrfs/disk-io.c:1691 \[inline\]
  RIP: 0010:write\_all\_supers+0x97a/0x40f0 fs/btrfs/disk-io.c:4041
  Call Trace:
   \<TASK\>
   btrfs\_commit\_transaction+0x1eae/0x3740 fs/btrfs/transaction.c:2530
   btrfs\_delete\_free\_space\_tree+0x383/0x730 fs/btrfs/free-space-tree.c:1312
   btrfs\_start\_pre\_rw\_mount+0xf28/0x1300 fs/btrfs/disk-io.c:3012
   btrfs\_remount\_rw fs/btrfs/super.c:1309 \[inline\]
   btrfs\_reconfigure+0xae6/0x2d40 fs/btrfs/super.c:1534
   btrfs\_reconfigure\_for\_mount fs/btrfs/super.c:2020 \[inline\]
   btrfs\_get\_tree\_subvol fs/btrfs/super.c:2079 \[inline\]
   btrfs\_get\_tree+0x918/0x1920 fs/btrfs/super.c:2115
   vfs\_get\_tree+0x90/0x2b0 fs/super.c:1800
   do\_new\_mount+0x2be/0xb40 fs/namespace.c:3472
   do\_mount fs/namespace.c:3812 \[inline\]
   \_\_do\_sys\_mount fs/namespace.c:4020 \[inline\]
   \_\_se\_sys\_mount+0x2d6/0x3c0 fs/namespace.c:3997
   do\_syscall\_x64 arch/x86/entry/common.c:52 \[inline\]
   do\_syscall\_64+0xf3/0x230 arch/x86/entry/common.c:83
   entry\_SYSCALL\_64\_after\_hwframe+0x77/0x7f

\[CAUSE\]
To support mounting different subvolume with different RO/RW flags for
the new mount APIs, btrfs introduced two workaround to support this feature:

- Skip mount option/feature checks if we are mounting a different
  subvolume

- Reconfigure the fs to RW if the initial mount is RO

Combining these two, we can have the following sequence:

- Mount the fs ro,rescue=all,clear\_cache,space\_cache=v1
  rescue=all will mark the fs as hard read-only, so no v2 cache clearing
  will happen.

- Mount a subvolume rw of the same fs.
  We go into btrfs\_get\_tree\_subvol(), but fc\_mount() returns EBUSY
  because our new fc is RW, different from the original fs.

  Now we enter btrfs\_reconfigure\_for\_mount(), which switches the RO flag
  first so that we can grab the existing fs\_info.
  Then we reconfigure the fs to RW.

- During reconfiguration, option/features check is skipped
  This means we will restart the v2 cache clearing, and convert back to
  v1 cache.
  This will trigger fs writes, and since the original fs has "rescue=all"
  option, it skips the csum tree read.

  And eventually causing NULL pointer dereference in super block
  writeback.

\[FIX\]
For reconfiguration caused by different subvolume RO/RW flags, ensure we
always run btrfs\_check\_options() to ensure we have proper hard RO
requirements met.

In fact the function btrfs\_check\_options() doesn't really do many
complex checks, but hard RO requirement and some feature dependency
checks, thus there is no special reason not to do the check for mount
reconfiguration.

## Affected and fixed versions

- Linux: \>= f044b318675f0347ecfb88377542651ba4eb9e1f, \< 23724398b55d9570f6ae79dd2ea026fff8896bf1; \>= f044b318675f0347ecfb88377542651ba4eb9e1f, \< 3c36a72c1d27de6618c1c480c793d9924640f5bb (cvelist)
- Linux: 6.8 (cvelist)

## Mitigation

- Upgrade Linux to 3c36a72c1d27de6618c1c480c793d9924640f5bb or later.

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by CVE-2024-50118. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2024-50118.md
Affected: Linux >= f044b318675f0347ecfb88377542651ba4eb9e1f, < 23724398b55d9570f6ae79dd2ea026fff8896bf1; >= f044b318675f0347ecfb88377542651ba4eb9e1f, < 3c36a72c1d27de6618c1c480c793d9924640f5bb; Linux 6.8
Fixed in: Linux 23724398b55d9570f6ae79dd2ea026fff8896bf1, Linux 3c36a72c1d27de6618c1c480c793d9924640f5bb

Steps:
1. Search this machine and project for Linux: dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
```

## FAQ

### Is CVE-2024-50118 being exploited?

There is no confirmed exploitation: CVE-2024-50118 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.26% chance of exploitation in the next 30 days (as of 2026-11-26).

### How serious is CVE-2024-50118?

Medium: CVSS 5.5 (v3.1, scored by CNA). Not remotely exploitable (local or adjacent access needed).

### Which versions are affected by CVE-2024-50118?

Linux \>= f044b318675f0347ecfb88377542651ba4eb9e1f, \< 23724398b55d9570f6ae79dd2ea026fff8896bf1; \>= f044b318675f0347ecfb88377542651ba4eb9e1f, \< 3c36a72c1d27de6618c1c480c793d9924640f5bb; Linux 6.8.

### Is there a fix for CVE-2024-50118?

Yes. Fixed in Linux 23724398b55d9570f6ae79dd2ea026fff8896bf1, Linux 3c36a72c1d27de6618c1c480c793d9924640f5bb. Upgrade Linux to 3c36a72c1d27de6618c1c480c793d9924640f5bb or later.

### How do I check if I'm affected by CVE-2024-50118?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

## References

- patch: <https://git.kernel.org/stable/c/23724398b55d9570f6ae79dd2ea026fff8896bf1>
- patch: <https://git.kernel.org/stable/c/3c36a72c1d27de6618c1c480c793d9924640f5bb>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- NVD: This product uses data from the NVD API but is not endorsed or certified by the NVD. <https://nvd.nist.gov/vuln/detail/CVE-2024-50118>

HTML: <https://flawdb.com/CVE-2024-50118> · JSON: <https://flawdb.com/api/v1/entries/CVE-2024-50118>
