CVE-2025-38059

btrfs: avoid NULL pointer dereference if no valid csum tree

No CVSS score yet EPSS 0.20%

Published 18 Jun 2025 Updated 30 Oct 2026 CNA: Linux

Check your servers for CVE-2025-38059

The Vulnpocalypse collector sends the package list of each Linux server and of its container images once a day. Vulnpocalypse shows every server where CVE-2025-38059 affects the running kernel, with the command that installs the fix. The free plan covers one server and one domain and does not need a credit card.

Check my servers

Description

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

btrfs: avoid NULL pointer dereference if no valid csum tree

[BUG] When trying read-only scrub on a btrfs with rescue=idatacsums mount option, it will crash with the following call trace:

BUG: kernel NULL pointer dereference, address: 0000000000000208 #PF: supervisor read access in kernel mode #PF: error_code(0x0000) - not-present page CPU: 1 UID: 0 PID: 835 Comm: btrfs Tainted: G O 6.15.0-rc3-custom+ #236 PREEMPT(full) Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS unknown 02/02/2022 RIP: 0010:btrfs_lookup_csums_bitmap+0x49/0x480 [btrfs] Call Trace: <TASK> scrub_find_fill_first_stripe+0x35b/0x3d0 [btrfs] scrub_simple_mirror+0x175/0x290 [btrfs] scrub_stripe+0x5f7/0x6f0 [btrfs] scrub_chunk+0x9a/0x150 [btrfs] scrub_enumerate_chunks+0x333/0x660 [btrfs] btrfs_scrub_dev+0x23e/0x600 [btrfs] btrfs_ioctl+0x1dcf/0x2f80 [btrfs] __x64_sys_ioctl+0x97/0xc0 do_syscall_64+0x4f/0x120 entry_SYSCALL_64_after_hwframe+0x76/0x7e

[CAUSE] Mount option "rescue=idatacsums" will completely skip loading the csum tree, so that any data read will not find any data csum thus we will ignore data checksum verification.

Normally call sites utilizing csum tree will check the fs state flag NO_DATA_CSUMS bit, but unfortunately scrub does not check that bit at all.

This results in scrub to call btrfs_search_slot() on a NULL pointer and triggered above crash.

[FIX] Check both extent and csum tree root before doing any tree search.

Exploitation

EPSS 0.20%: the probability of exploitation activity in the next 30 days, from the EPSS model of FIRST. The score is higher than 10.9% of all scored CVEs. Scores of 1 Dec 2026.

Affected products

As the CNA lists them.

ProductVersions
Linux
affected from 74ef00185eb864252156022ff129b01549504175, before 2db25048a61c0909459b074af04e06ab8a8b939e
affected from 74ef00185eb864252156022ff129b01549504175, before 50d0de59f66cbe6d597481e099bf1c70fd07e0a9
affected from 74ef00185eb864252156022ff129b01549504175, before 6e9770de024964b1017f99ee94f71967bd6edaeb
affected from 74ef00185eb864252156022ff129b01549504175, before d35bed14b0bc95c6845863a3744ecd10b888c830
affected from 74ef00185eb864252156022ff129b01549504175, before f95d186255b319c48a365d47b69bd997fecb674e
Other versions: unaffected
Linux
affected 5.9
unaffected before 5.9
unaffected from 6.1.191 up to and including 6.1.*
unaffected from 6.6.93 up to and including 6.6.*
unaffected from 6.12.31 up to and including 6.12.*
unaffected from 6.14.9 up to and including 6.14.*
unaffected 6.15 and later
Other versions: affected

Is my server affected?

This CVE is in the Linux kernel. Compare the running kernel with the fixed kernel version of your distribution, and reboot after a kernel update:

uname -r
# Debian, Ubuntu: does the changelog of the running kernel name the CVE?
zgrep -l CVE-2025-38059 /usr/share/doc/linux-image-$(uname -r)/changelog.Debian.gz
# RHEL, Rocky, Alma
rpm -q --changelog kernel | grep CVE-2025-38059

With Trivy, on the host and for a container image. When a package is affected, it prints the installed and the fixed version:

trivy rootfs --scanners vuln / | grep CVE-2025-38059
trivy image --scanners vuln IMAGE | grep CVE-2025-38059

Vulnpocalypse makes this comparison every day for the package lists of your servers and container images, including language packages (npm, PyPI, Go, Maven and others), and sends the command that installs the fix. Start free with one server and one domain or read how to install the collector.

References

Other references

Source: the record CVE-2025-38059 of the CVE List (CVE Program), CVE Terms of Use; EPSS of FIRST. The text of the record is shown as published. Data sources and licences.