]> git.ipfire.org Git - thirdparty/linux.git/commit
btrfs: check for NULL root after calls to btrfs_extent_root()
authorFilipe Manana <fdmanana@suse.com>
Sun, 8 Feb 2026 19:24:16 +0000 (19:24 +0000)
committerDavid Sterba <dsterba@suse.com>
Tue, 17 Mar 2026 10:22:49 +0000 (11:22 +0100)
commit50242828700f06edfa8d563f9e0acc23a59424ee
tree8d3829f2fdb362893382171e0cebc240e6dfed9f
parentfc1cd1f18c34f91e78362f9629ab9fd43b9dcab9
btrfs: check for NULL root after calls to btrfs_extent_root()

btrfs_extent_root() can return a NULL pointer in case the root we are
looking for is not in the rb tree that tracks roots. So add checks to
every caller that is missing such check to log a message and return
an error. The same applies to callers of btrfs_block_group_root(),
since it calls btrfs_extent_root().

Reported-by: Chris Mason <clm@meta.com>
Link: https://lore.kernel.org/linux-btrfs/20260208161657.3972997-1-clm@meta.com/
Reviewed-by: Boris Burkov <boris@bur.io>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/backref.c
fs/btrfs/block-group.c
fs/btrfs/disk-io.c
fs/btrfs/extent-tree.c
fs/btrfs/free-space-tree.c
fs/btrfs/qgroup.c
fs/btrfs/relocation.c
fs/btrfs/zoned.c