]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: Enhance chunk validation check
authorQu Wenruo <quwenruo@cn.fujitsu.com>
Tue, 15 Dec 2015 01:14:37 +0000 (09:14 +0800)
committerChris Mason <clm@fb.com>
Wed, 20 Jan 2016 02:21:41 +0000 (18:21 -0800)
commitf7f3ce803f76f5d7b1ee1a1db6f1ee59c5c72ef2
treef69d161dd9d146284d0e0870fcfce492ea210a6a
parent74658dd15a5579f4c3ca90a36ecaeca2d9ac81d3
btrfs: Enhance chunk validation check

Enhance chunk validation:
1) Num_stripes
   We already have such check but it's only in super block sys chunk
   array.
   Now check all on-disk chunks.

2) Chunk logical
   It should be aligned to sector size.
   This behavior should be *DOUBLE CHECKED* for 64K sector size like
   PPC64 or AArch64.
   Maybe we can found some hidden bugs.

3) Chunk length
   Same as chunk logical, should be aligned to sector size.

4) Stripe length
   It should be power of 2.

5) Chunk type
   Any bit out of TYPE_MAS | PROFILE_MASK is invalid.

With all these much restrict rules, several fuzzed image reported in
mail list should no longer cause kernel panic.

Reported-by: Vegard Nossum <vegard.nossum@oracle.com>
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: Chris Mason <clm@fb.com>
fs/btrfs/volumes.c