From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: dsterba@suse.cz, Zhang Cen <rollkingzzc@gmail.com>
Cc: Chris Mason <clm@fb.com>, David Sterba <dsterba@suse.com>,
linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org,
Qu Wenruo <wqu@suse.com>,
zerocling0077@gmail.com, 2045gemini@gmail.com
Subject: Re: [PATCH v3] btrfs: free-space-tree: reject mismatched extent and bitmap items
Date: Wed, 13 May 2026 07:30:30 +0930 [thread overview]
Message-ID: <623ab375-5de1-4d21-bccd-29a872aa5bc4@gmx.com> (raw)
In-Reply-To: <20260512151846.GJ2558453@twin.jikos.cz>
在 2026/5/13 00:48, David Sterba 写道:
> On Sun, May 10, 2026 at 11:03:22PM +0800, Zhang Cen wrote:
>> +static int validate_free_space_key(struct btrfs_block_group *block_group,
>> + const struct btrfs_key *key,
>> + u8 expected_type)
>> +{
>> + const u64 end = btrfs_block_group_end(block_group);
>> +
>> + if (unlikely(key->type != expected_type)) {
>> + btrfs_err(block_group->fs_info,
>> + "block group %llu has unexpected free space key type %u, expected %u",
>> + block_group->start, key->type, expected_type);
>> + return -EUCLEAN;
>> + }
>> +
>> + if (unlikely(key->objectid + key->offset > end)) {
>
> This has a review comment https://sashiko.dev/#/patchset/20260510152848.3844894-1-rollkingzzc%40gmail.com
> that the expression can overflow. I did a light check if it is valid at
> all (we're still evaluating the quality of AI reviews) but I think in
> this case more checks to the key.offset and key.objectid could be added.
> As this would is in checker it's meant to be extensive so partially
> overlapping conditions are not a problem.
>
I have already submitted tree-checker enhancement to address this:
https://lore.kernel.org/linux-btrfs/cover.1778460959.git.wqu@suse.com/T/
Which adds extra overflow and overlap checks for fst.
Thanks,
Qu
next prev parent reply other threads:[~2026-05-12 22:00 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-10 7:49 [PATCH] btrfs: free-space-tree: reject mismatched extent and bitmap items Zhang Cen
2026-05-10 8:11 ` Qu Wenruo
[not found] ` <qu-fstree-20260510-161100@local>
2026-05-10 14:37 ` Zhang Cen
2026-05-10 14:42 ` [PATCH v2] " Zhang Cen
2026-05-10 14:44 ` Cen Zhang
2026-05-10 15:03 ` [PATCH v3] " Zhang Cen
2026-05-10 22:18 ` Qu Wenruo
2026-05-11 1:57 ` Cen Zhang
2026-05-12 15:18 ` David Sterba
2026-05-12 22:00 ` Qu Wenruo [this message]
-- strict thread matches above, loose matches on Subject: below --
2026-05-10 15:28 Zhang Cen
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=623ab375-5de1-4d21-bccd-29a872aa5bc4@gmx.com \
--to=quwenruo.btrfs@gmx.com \
--cc=2045gemini@gmail.com \
--cc=clm@fb.com \
--cc=dsterba@suse.com \
--cc=dsterba@suse.cz \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rollkingzzc@gmail.com \
--cc=wqu@suse.com \
--cc=zerocling0077@gmail.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox