path: root/volumes.h
diff options
authorQu Wenruo <>2016-08-29 16:09:02 +0800
committerDavid Sterba <>2016-09-05 10:04:16 +0200
commit2f242115d1c3a395158d5b6d6d31ad4ae9a2c991 (patch)
tree307c9d3bd2b2d00162bde510ab34a7b1301d5f9e /volumes.h
parentf1934f4c7832efd362a177641c5409179555169e (diff)
btrfs-progs: Do extra chunk check before processing chunk item
Current we only do chunk validation check at mount time. It's good for most case, but for fuzzed or manually crafted images, we can insert a CHUNK_ITEM key into root tree. Since mount time check will only check chunk tree, it will not check CHUNK_ITEM in root tree. Even with previous key type check against leaf owner, it is still possible to modify the leaf owner to by-pass it. So we still need to check chunk validation before processing it. Reported-by: Lukas Lueg <> Signed-off-by: Qu Wenruo <> Signed-off-by: David Sterba <>
Diffstat (limited to 'volumes.h')
1 files changed, 4 insertions, 0 deletions
diff --git a/volumes.h b/volumes.h
index af7182b8..d7b7d3cc 100644
--- a/volumes.h
+++ b/volumes.h
@@ -226,4 +226,8 @@ int write_raid56_with_parity(struct btrfs_fs_info *info,
struct extent_buffer *eb,
struct btrfs_multi_bio *multi,
u64 stripe_len, u64 *raid_map);
+int btrfs_check_chunk_valid(struct btrfs_root *root,
+ struct extent_buffer *leaf,
+ struct btrfs_chunk *chunk,
+ int slot, u64 logical);