From: Liu Bo <bo.li.liu@oracle.com>
To: linux-btrfs@vger.kernel.org
Cc: vegard.nossum@oracle.com, dsterba@suse.com
Subject: Re: [PATCH 1/2] Btrfs: add more valid checks for superblock
Date: Mon, 2 May 2016 11:23:21 -0700 [thread overview]
Message-ID: <20160502182320.GA1158@localhost.localdomain> (raw)
In-Reply-To: <1462212951-28113-1-git-send-email-bo.li.liu@oracle.com>
Oh Dave, I got to use a wrong email address of yours and got some failures.
Thanks,
-liubo
On Mon, May 02, 2016 at 11:15:50AM -0700, Liu Bo wrote:
> This adds valid checks for super_total_bytes, super_bytes_used and
> super_stripesize.
>
> Reported-by: Vegard Nossum <vegard.nossum@oracle.com>
> Reported-by: Quentin Casasnovas <quentin.casasnovas@oracle.com>
> Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
> ---
> fs/btrfs/disk-io.c | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
>
> diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
> index 4e47849..988d03f 100644
> --- a/fs/btrfs/disk-io.c
> +++ b/fs/btrfs/disk-io.c
> @@ -4120,6 +4120,20 @@ static int btrfs_check_super_valid(struct btrfs_fs_info *fs_info,
> * Hint to catch really bogus numbers, bitflips or so, more exact checks are
> * done later
> */
> + if (btrfs_super_total_bytes(sb) == 0) {
> + printk(KERN_ERR "BTRFS: total bytes is zero\n");
> + ret = -EINVAL;
> + }
> + if (btrfs_super_bytes_used(sb) < 6 * btrfs_super_nodesize(sb)) {
> + printk(KERN_ERR "BTRFS: bytes_used is too small %llu\n",
> + btrfs_super_bytes_used(sb));
> + ret = -EINVAL;
> + }
> + if (btrfs_super_stripesize(sb) != 4096) {
> + printk(KERN_ERR "BTRFS: invalid stripesize %u\n",
> + btrfs_super_stripesize(sb));
> + ret = -EINVAL;
> + }
> if (btrfs_super_num_devices(sb) > (1UL << 31))
> printk(KERN_WARNING "BTRFS: suspicious number of devices: %llu\n",
> btrfs_super_num_devices(sb));
> --
> 2.5.5
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2016-05-02 18:22 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-02 18:15 [PATCH 1/2] Btrfs: add more valid checks for superblock Liu Bo
2016-05-02 18:15 ` [PATCH 2/2] Btrfs: add valid checks for chunk loading Liu Bo
2016-05-03 1:12 ` Qu Wenruo
2016-05-03 23:36 ` Liu Bo
2016-05-05 1:03 ` Qu Wenruo
2016-05-03 5:53 ` Anand Jain
2016-05-03 23:33 ` Liu Bo
2016-05-04 13:56 ` David Sterba
2016-05-13 23:57 ` Liu Bo
2016-05-17 13:37 ` David Sterba
2016-05-02 18:23 ` Liu Bo [this message]
2016-05-03 1:02 ` [PATCH 1/2] Btrfs: add more valid checks for superblock Qu Wenruo
2016-05-03 23:32 ` Liu Bo
2016-05-04 13:23 ` David Sterba
2016-05-04 17:44 ` Liu Bo
2016-05-05 1:08 ` Qu Wenruo
2016-05-06 14:35 ` David Sterba
2016-05-09 1:31 ` Qu Wenruo
2016-05-13 18:14 ` Liu Bo
2016-05-13 23:42 ` Qu Wenruo
2016-05-17 13:47 ` David Sterba
2016-05-04 13:29 ` David Sterba
2016-05-04 17:40 ` Liu Bo
2016-05-06 14:39 ` 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=20160502182320.GA1158@localhost.localdomain \
--to=bo.li.liu@oracle.com \
--cc=dsterba@suse.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=vegard.nossum@oracle.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;
as well as URLs for NNTP newsgroup(s).