Re: [PATCH] btrfs: Check superblock csum type to avoid 0 division or array overflow.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux