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

btrfs: balance: fix potential bg lookup failure in btrfs_may_alloc_data_chunk()

[BUG]
Running btrfs balance can trigger a null-ptr-deref before relocating a
data chunk when metadata corruption leaves a chunk in the chunk tree
without a corresponding block group in the in-memory cache:

KASAN: null-ptr-deref in range [0x0000000000000088-0x000000000000008f]
RIP: 0010:btrfs_may_alloc_data_chunk+0x40/0x1c0 fs/btrfs/volumes.c:3601
Call Trace:
__btrfs_balance fs/btrfs/volumes.c:4217 [inline]
btrfs_balance+0x2516/0x42b0 fs/btrfs/volumes.c:4604
btrfs_ioctl_balance fs/btrfs/ioctl.c:3577 [inline]
btrfs_ioctl+0x25cf/0x5b90 fs/btrfs/ioctl.c:5313
...

[CAUSE]
__btrfs_balance() iterates the on-disk chunk tree and passes the chunk
logical bytenr to btrfs_may_alloc_data_chunk() before relocating a data
chunk. That helper then queries the in-memory block group cache:

cache = btrfs_lookup_block_group(fs_info, chunk_offset);
chunk_type = cache->flags; /* cache may be NULL */

A corrupt image can contain a chunk item whose matching block group
item is missing, so no block group is ever inserted into the cache. In
that case btrfs_lookup_block_group() returns NULL.

The code only guards this with ASSERT(cache), which becomes a no-op when
CONFIG_BTRFS_ASSERT is disabled. The subsequent dereference of
cache->flags therefore crashes the kernel.

[FIX]
Add a NULL check after btrfs_lookup_block_group() in
btrfs_may_alloc_data_chunk() and print and error message for clarity.
Published: 2026-09-24
Score: n/a
EPSS: n/a
KEV: No
Impact: Kernel Crash / Denial of Service
Action: Immediate Patch
AI Analysis

Impact

A NULL pointer dereference occurs in the BTRFS balance routine when metadata corruption leaves a chunk entry without a matching block group in memory. The lookup function returns NULL, and the code proceeds to use the pointer, causing a kernel crash. The crash results in a kernel panic that brings the entire system down, effectively delivering a denial‑of‑service condition.

Affected Systems

All Linux kernel releases that include the BTRFS file‑system implementation prior to the commit that added the NULL‑check. The advisory does not list a specific kernel version range, so any kernel that has not been updated to the patch commit 18d32b0013efba19f7add7aee813d604a6 is potentially affected. The affected product is the Linux kernel; vendor is Linux.

Risk and Exploitability

The EPSS score is not available and the vulnerability is not listed in CISA KEV, indicating no publicly known exploits to date. The most likely attack vector is a local attacker who can introduce or exploit metadata corruption and then run 'btrfs balance' on the affected file system. Because the crash occurs inside the privileged kernel, the impact is severe and can be leveraged for privilege escalation if the attacker can execute code in kernel space. The flaw is easy to trigger once corruption exists, making exploitation practical in an insider or compromised environment.

Generated by OpenCVE AI on September 25, 2026 at 04:40 UTC.

Remediation

No vendor fix or workaround currently provided.

OpenCVE Recommended Actions

  • Upgrade the Linux kernel to a version that includes the patch commit 18d32b0013efba19f7ad3e5b08d7aee813d604a6.
  • If an immediate kernel upgrade is not possible, disable or prevent the use of the btrfs balance command on affected volumes, or mount the volume read‑only until the corruption is repaired.
  • Enable CONFIG_BTRFS_ASSERT, monitor system logs for KASAN or kernel panic messages, and remount or rebuild affected BTRFS file systems when corruption is detected.

Generated by OpenCVE AI on September 25, 2026 at 04:40 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories yet.

History

Fri, 25 Sep 2026 05:00:00 +0000

Type Values Removed Values Added
Weaknesses CWE-476

Thu, 24 Sep 2026 16:30:00 +0000

Type Values Removed Values Added
Description In the Linux kernel, the following vulnerability has been resolved: btrfs: balance: fix potential bg lookup failure in btrfs_may_alloc_data_chunk() [BUG] Running btrfs balance can trigger a null-ptr-deref before relocating a data chunk when metadata corruption leaves a chunk in the chunk tree without a corresponding block group in the in-memory cache: KASAN: null-ptr-deref in range [0x0000000000000088-0x000000000000008f] RIP: 0010:btrfs_may_alloc_data_chunk+0x40/0x1c0 fs/btrfs/volumes.c:3601 Call Trace: __btrfs_balance fs/btrfs/volumes.c:4217 [inline] btrfs_balance+0x2516/0x42b0 fs/btrfs/volumes.c:4604 btrfs_ioctl_balance fs/btrfs/ioctl.c:3577 [inline] btrfs_ioctl+0x25cf/0x5b90 fs/btrfs/ioctl.c:5313 ... [CAUSE] __btrfs_balance() iterates the on-disk chunk tree and passes the chunk logical bytenr to btrfs_may_alloc_data_chunk() before relocating a data chunk. That helper then queries the in-memory block group cache: cache = btrfs_lookup_block_group(fs_info, chunk_offset); chunk_type = cache->flags; /* cache may be NULL */ A corrupt image can contain a chunk item whose matching block group item is missing, so no block group is ever inserted into the cache. In that case btrfs_lookup_block_group() returns NULL. The code only guards this with ASSERT(cache), which becomes a no-op when CONFIG_BTRFS_ASSERT is disabled. The subsequent dereference of cache->flags therefore crashes the kernel. [FIX] Add a NULL check after btrfs_lookup_block_group() in btrfs_may_alloc_data_chunk() and print and error message for clarity.
Title btrfs: balance: fix potential bg lookup failure in btrfs_may_alloc_data_chunk()
First Time appeared Linux
Linux linux Kernel
CPEs cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
Vendors & Products Linux
Linux linux Kernel
References

Subscriptions

Linux Linux Kernel
cve-icon MITRE

Status: PUBLISHED

Assigner: Linux

Published:

Updated: 2026-09-24T16:03:23.731Z

Reserved: 2026-09-24T14:53:16.867Z

Link: CVE-2026-97416

cve-icon Vulnrichment

No data.

cve-icon NVD

Status : Received

Published: 2026-09-24T17:17:19.340

Modified: 2026-09-24T17:17:19.340

Link: CVE-2026-97416

cve-icon Redhat

No data.

cve-icon OpenCVE Enrichment

Updated: 2026-09-25T04:45:16Z

Weaknesses