-------- Original Message --------
Subject: Re: [PATCH] btrfs: Check superblock csum type to avoid 0
division or array overflow.
From: David Sterba <dste...@suse.cz>
To: Qu Wenruo <quwen...@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
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html