Skip to content

Commit bf61aa8

Browse files
mechanicalamitkdave
authored andcommitted
btrfs: ref-verify: fix IS_ERR() vs NULL check in btrfs_build_ref_tree()
btrfs_extent_root()/btrfs_global_root() does not return error pointers, it returns NULL on error. Reported-by: Dan Carpenter <dan.carpenter@linaro.org> Link: https://lore.kernel.org/all/aNJfvxj0anEnk9Dm@stanley.mountain/ Fixes : ed4e6b5 ("btrfs: ref-verify: handle damaged extent root tree") CC: stable@vger.kernel.org # 6.17+ Signed-off-by: Amit Dhingra <mechanicalamit@gmail.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
1 parent c6c9991 commit bf61aa8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/btrfs/ref-verify.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -982,7 +982,7 @@ int btrfs_build_ref_tree(struct btrfs_fs_info *fs_info)
982982

983983
extent_root = btrfs_extent_root(fs_info, 0);
984984
/* If the extent tree is damaged we cannot ignore it (IGNOREBADROOTS). */
985-
if (IS_ERR(extent_root)) {
985+
if (!extent_root) {
986986
btrfs_warn(fs_info, "ref-verify: extent tree not available, disabling");
987987
btrfs_clear_opt(fs_info->mount_opt, REF_VERIFY);
988988
return 0;

0 commit comments

Comments
 (0)