From: Qu Wenruo <wqu@suse.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH 1/3] btrfs-progs: check: orig: Don't panic out when unexpected root item is referring to one extent
Date: Thu, 5 Jul 2018 15:45:56 +0800 [thread overview]
Message-ID: <20180705074558.20022-1-wqu@suse.com> (raw)
With crafted image, expected root item can refer to certain extent, and
original mode uses BUG_ON() to handle such case.
Fix it by gracefully return error.
Link: https://bugzilla.kernel.org/show_bug.cgi?id=200403
Signed-off-by: Qu Wenruo <wqu@suse.com>
---
check/main.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/check/main.c b/check/main.c
index 8db300abb825..6f1182106071 100644
--- a/check/main.c
+++ b/check/main.c
@@ -3724,7 +3724,12 @@ static int check_owner_ref(struct btrfs_root *root,
if (btrfs_header_owner(buf) == back->root)
return 0;
}
- BUG_ON(rec->is_root);
+ /*
+ * Some unexpected root item referring to this one, return 1 to
+ * indicate owner not found
+ */
+ if (rec->is_root)
+ return 1;
/* try to find the block by search corresponding fs tree */
key.objectid = btrfs_header_owner(buf);
--
2.18.0
next reply other threads:[~2018-07-05 7:46 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-05 7:45 Qu Wenruo [this message]
2018-07-05 7:45 ` [PATCH 2/3] btrfs-progs: tests/fuzz: Add fuzzed test image for btrfs check BUG_ON Qu Wenruo
2018-07-05 7:45 ` [PATCH 3/3] btrfs-progs: test/fuzz: Add image for BUG_ON() when opening the fs by btrfs check Qu Wenruo
2018-07-16 16:15 ` [PATCH 1/3] btrfs-progs: check: orig: Don't panic out when unexpected root item is referring to one extent David Sterba
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180705074558.20022-1-wqu@suse.com \
--to=wqu@suse.com \
--cc=linux-btrfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.