43 lines
1.3 KiB
Diff
43 lines
1.3 KiB
Diff
From 0eeb12aef5ed18b3ecb5346440742971d5b11703 Mon Sep 17 00:00:00 2001
|
|
From: Qu Wenruo <wqu@suse.com>
|
|
Date: Tue, 4 Jun 2024 14:17:51 +0930
|
|
Subject: [PATCH] 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>
|
|
---
|
|
kernel-shared/backref.c | 3 ++-
|
|
1 file changed, 2 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/kernel-shared/backref.c b/kernel-shared/backref.c
|
|
index d9e8d2f..6866d6d 100644
|
|
--- a/kernel-shared/backref.c
|
|
+++ b/kernel-shared/backref.c
|
|
@@ -650,7 +650,8 @@ static int __add_inline_refs(struct btrfs_fs_info *fs_info,
|
|
break;
|
|
}
|
|
default:
|
|
- WARN_ON(1);
|
|
+ error("invalid backref type: %u", type);
|
|
+ ret = -EUCLEAN;
|
|
}
|
|
if (ret)
|
|
return ret;
|
|
--
|
|
2.43.0
|
|
|