CVE-2026-46159

MEDIUM

btrfs: fix btrfs_ioctl_space_info() slot_count TOCTOU which can lead to info-leak

Title source: cna
STIX 2.1

Description

In the Linux kernel, the following vulnerability has been resolved: btrfs: fix btrfs_ioctl_space_info() slot_count TOCTOU which can lead to info-leak btrfs_ioctl_space_info() has a TOCTOU race between two passes over the block group RAID type lists. The first pass counts entries to determine the allocation size, then the second pass fills the buffer. The groups_sem rwlock is released between passes, allowing concurrent block group removal to reduce the entry count. When the second pass fills fewer entries than the first pass counted, copy_to_user() copies the full alloc_size bytes including trailing uninitialized kmalloc bytes to userspace. Fix by copying only total_spaces entries (the actually-filled count from the second pass) instead of alloc_size bytes, and switch to kzalloc so any future copy size mismatch cannot leak heap data.

Scores

CVSS v3 4.7
EPSS 0.0009
EPSS Percentile 0.7%
Attack Vector LOCAL
CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:N/A:H

Details

CWE
CWE-367
Status published
Products (15)
Linux/Linux < 2.6.34
Linux/Linux 2.6.34
Linux/Linux 6.12.90 - 6.12.*
Linux/Linux 6.18.32 - 6.18.*
Linux/Linux 6.6.140 - 6.6.*
Linux/Linux 7.0.7 - 7.0.*
Linux/Linux 7.1
Linux/Linux 7.1-rc1
Linux/Linux 7fde62bffb576d384ea49a3aed3403d5609ee5bc - 4fdc6ee0802121d9cd96b8d085e589f51e5a4ec3
Linux/Linux 7fde62bffb576d384ea49a3aed3403d5609ee5bc - 5d12e0ab009ade48c1bff9324fd9bea2c773d088
... and 5 more
Published May 28, 2026
Tracked Since May 28, 2026