From: Qu Wenruo <quwenruo@cn.fujitsu.com>
To: <dsterba@suse.cz>, <linux-btrfs@vger.kernel.org>, <lukas.lueg@gmail.com>
Subject: Re: [PATCH] btrfs: Check superblock csum type to avoid 0 division or array overflow.
Date: Fri, 24 Apr 2015 08:37:35 +0800 [thread overview]
Message-ID: <5539904F.4060605@cn.fujitsu.com> (raw)
In-Reply-To: <20150423161659.GL4996@twin.jikos.cz>
-------- Original Message --------
Subject: Re: [PATCH] btrfs: Check superblock csum type to avoid 0
division or array overflow.
From: David Sterba <dsterba@suse.cz>
To: Qu Wenruo <quwenruo@cn.fujitsu.com>
Date: 2015年04月24日 00:16
> On Thu, Apr 23, 2015 at 09:31:21AM +0800, Qu Wenruo wrote:
>> Current btrfs only support CRC32 checksum, and if csum_type is 1, we
>> will get 0 csum size, causing 0 division later destroy the whole kernel.
>> Or csum_type is later than 1, we will get data from other random memory
>> causing more problem.
>
> The check for csum type is already there in btrfs_check_super_csum, but
> it's wrong and should be fixed.
>
> btrfs_csum_sizes = { 4, 0 };
>
> 429 if (csum_type >= ARRAY_SIZE(btrfs_csum_sizes)) {
> 430 printk(KERN_ERR "BTRFS: unsupported checksum algorithm %u\n",
> 431 csum_type);
> 432 ret = 1;
> 433 }
> 434
>
> and the check fails to catch csum_type == 1.
>
Thanks for pointing the existing codes, I'll update the patch.
Thanks,
Qu
prev parent reply other threads:[~2015-04-24 0:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-23 1:31 [PATCH] btrfs: Check superblock csum type to avoid 0 division or array overflow Qu Wenruo
2015-04-23 16:16 ` David Sterba
2015-04-24 0:37 ` Qu Wenruo [this message]
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=5539904F.4060605@cn.fujitsu.com \
--to=quwenruo@cn.fujitsu.com \
--cc=dsterba@suse.cz \
--cc=linux-btrfs@vger.kernel.org \
--cc=lukas.lueg@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 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.