]> git.hungrycats.org Git - linux/commit
btrfs: Enhance chunk validation check
authorQu Wenruo <quwenruo@cn.fujitsu.com>
Tue, 15 Dec 2015 01:14:37 +0000 (09:14 +0800)
committerZygo Blaxell <zblaxell@thirteen.furryterror.org>
Sun, 24 Jan 2016 04:09:31 +0000 (23:09 -0500)
commit40060161bb1c08dcf42f2f283094bdfd13937a5a
tree840421e5b5d775b586a6af837b5606dda64002b4
parent513387264f159b8d654360dd1471806b42559274
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>
(cherry picked from commit f04b772bfc17f502703794f4d100d12155c1a1a9)
fs/btrfs/volumes.c