public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Josef Bacik <josef@toxicpanda.com>
To: Qu Wenruo <wqu@suse.com>, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] btrfs: tree-checker: Check leaf chunk item size
Date: Tue, 17 Dec 2019 10:49:08 -0500	[thread overview]
Message-ID: <96888112-822b-83a9-ebde-2f5f76d9b2f2@toxicpanda.com> (raw)
In-Reply-To: <20191217105820.20884-1-wqu@suse.com>

On 12/17/19 5:58 AM, Qu Wenruo wrote:
> Inspired by btrfs-progs github issue #208, where chunk item in chunk
> tree has invalid num_stripes (0).
> 
> Although that can already be catched by current btrfs_check_chunk_valid(),
> that function doesn't really check item size as it needs to handle chunk
> item in super block sys_chunk_array().
> 
> This patch will just add two extra checks for chunk items in chunk tree:
> - Basic chunk item size
>    If the item is smaller than btrfs_chunk (which already contains one
>    stripe), exit right now as reading num_stripes may even go beyond
>    eb boundary.
> 
> - Item size check against num_stripes
>    If item size doesn't match with calculated chunk size, then either the
>    item size or the num_stripes is corrupted. Error out anyway.
> 
> Signed-off-by: Qu Wenruo <wqu@suse.com>

Reviewed-by: Josef Bacik <josef@toxicpanda.com>

Thanks,

Josef

  reply	other threads:[~2019-12-17 15:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-17 10:58 [PATCH] btrfs: tree-checker: Check leaf chunk item size Qu Wenruo
2019-12-17 15:49 ` Josef Bacik [this message]
2020-01-02 13:25 ` 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=96888112-822b-83a9-ebde-2f5f76d9b2f2@toxicpanda.com \
    --to=josef@toxicpanda.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=wqu@suse.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