Skip to content

Commit 0eeb12a

Browse files
adam900710kdave
authored andcommitted
btrfs-progs: error out immediately if an unknown backref type is found
There is a bug report that for fuzzed image bko-155621-bad-block-group-offset.raw, "btrfs check --mode=lowmem --repair" would lead to an endless loop. Unlike original mode, lowmem mode relies on the backref walk to properly go through each root, but unfortunately inside __add_inline_refs() we doesn't handle unknown backref types correctly, causing it never moving forward thus deadloop. Fix it by erroring out to prevent an endless loop. Issue: #788 Reviewed-by: Josef Bacik <josef@toxicpanda.com> Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
1 parent cef75dd commit 0eeb12a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

kernel-shared/backref.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -650,7 +650,8 @@ static int __add_inline_refs(struct btrfs_fs_info *fs_info,
650650
break;
651651
}
652652
default:
653-
WARN_ON(1);
653+
error("invalid backref type: %u", type);
654+
ret = -EUCLEAN;
654655
}
655656
if (ret)
656657
return ret;

0 commit comments

Comments
 (0)