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


