vulnerability
SUSE: CVE-2021-47508: SUSE Linux Security Advisory
Severity | CVSS | Published | Added | Modified |
---|---|---|---|---|
6 | (AV:L/AC:L/Au:S/C:C/I:N/A:C) | 05/24/2024 | 08/09/2024 | 02/18/2025 |
Description
In the Linux kernel, the following vulnerability has been resolved:
btrfs: free exchange changeset on failures
Fstests runs on my VMs have show several kmemleak reports like the following.
unreferenced object 0xffff88811ae59080 (size 64):
comm "xfs_io", pid 12124, jiffies 4294987392 (age 6.368s)
hex dump (first 32 bytes):
00 c0 1c 00 00 00 00 00 ff cf 1c 00 00 00 00 00 ................
90 97 e5 1a 81 88 ff ff 90 97 e5 1a 81 88 ff ff ................
backtrace:
[] ulist_add_merge+0x60/0x150 [btrfs]
[] set_state_bits+0x86/0xc0 [btrfs]
[] set_extent_bit+0x270/0x690 [btrfs]
[] set_record_extent_bits+0x19/0x20 [btrfs]
[] qgroup_reserve_data+0x274/0x310 [btrfs]
[] btrfs_check_data_free_space+0x5c/0xa0 [btrfs]
[] btrfs_delalloc_reserve_space+0x1b/0xa0 [btrfs]
[] btrfs_dio_iomap_begin+0x415/0x970 [btrfs]
[] iomap_iter+0x161/0x1e0
[] __iomap_dio_rw+0x1df/0x700
[] iomap_dio_rw+0x5/0x20
[] btrfs_file_write_iter+0x290/0x530 [btrfs]
[] new_sync_write+0x106/0x180
[] vfs_write+0x24d/0x2f0
[] __x64_sys_pwrite64+0x69/0xa0
[] do_syscall_64+0x43/0x90
In case brtfs_qgroup_reserve_data() or btrfs_delalloc_reserve_metadata()
fail the allocated extent_changeset will not be freed.
So in btrfs_check_data_free_space() and btrfs_delalloc_reserve_space()
free the allocated extent_changeset to get rid of the allocated memory.
The issue currently only happens in the direct IO write path, but only
after 65b3c08606e5 ("btrfs: fix ENOSPC failure when attempting direct IO
write into NOCOW range"), and also at defrag_one_locked_target(). Every
other place is always calling extent_changeset_free() even if its call
to btrfs_delalloc_reserve_space() or btrfs_check_data_free_space() has
failed.
Solution(s)

Explore Exposure Command
Confidently identify and prioritize exposures from endpoint to cloud with full attack surface visibility and threat-aware risk context.