Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

btrfs: check block group lookup in remove_range_from_remap_tree()

Add a check in remove_range_from_remap_tree() after we call
btrfs_lookup_block_group(), to check if it is NULL. This shouldn't
happen, but if it does we at least get an error rather than a segfault.

Reported-by: Chris Mason <clm@fb.com>
Link: https://lore.kernel.org/linux-btrfs/20260125125129.2245240-1-clm@meta.com/
Fixes: 979e1dc3d69e ("btrfs: handle deletions from remapped block group")
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Mark Harmstone <mark@harmstone.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>

authored by

Mark Harmstone and committed by
David Sterba
f8db8009 7885ca40

+3
+3
fs/btrfs/relocation.c
··· 5985 5985 struct btrfs_block_group *dest_bg; 5986 5986 5987 5987 dest_bg = btrfs_lookup_block_group(fs_info, new_addr); 5988 + if (unlikely(!dest_bg)) 5989 + return -EUCLEAN; 5990 + 5988 5991 adjust_block_group_remap_bytes(trans, dest_bg, -overlap_length); 5989 5992 btrfs_put_block_group(dest_bg); 5990 5993 ret = btrfs_add_to_free_space_tree(trans,