summaryrefslogtreecommitdiff
path: root/include/uapi
diff options
context:
space:
mode:
authorQu Wenruo <quwenruo.btrfs@gmx.com>2017-08-23 16:57:58 +0900
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-12-05 19:41:11 +0100
commitfa5d29e6d7cbfac45e3b7bdb7bb3d48f124bbe55 (patch)
tree6b8ef957ec0ce39ecf9437271d544306299095c2 /include/uapi
parentac6ea50bb6306ed056222a5967b2bad3c3a9e2dd (diff)
downloadlinux-exynos-fa5d29e6d7cbfac45e3b7bdb7bb3d48f124bbe55.tar.gz
linux-exynos-fa5d29e6d7cbfac45e3b7bdb7bb3d48f124bbe55.tar.bz2
linux-exynos-fa5d29e6d7cbfac45e3b7bdb7bb3d48f124bbe55.zip
btrfs: Add sanity check for EXTENT_DATA when reading out leaf
commit 40c3c40947324d9f40bf47830c92c59a9bbadf4a upstream. Add extra checks for item with EXTENT_DATA type. This checks the following thing: 0) Key offset All key offsets must be aligned to sectorsize. Inline extent must have 0 for key offset. 1) Item size Uncompressed inline file extent size must match item size. (Compressed inline file extent has no information about its on-disk size.) Regular/preallocated file extent size must be a fixed value. 2) Every member of regular file extent item Including alignment for bytenr and offset, possible value for compression/encryption/type. 3) Type/compression/encode must be one of the valid values. This should be the most comprehensive and strict check in the context of btrfs_item for EXTENT_DATA. Signed-off-by: Qu Wenruo <quwenruo.btrfs@gmx.com> Reviewed-by: Nikolay Borisov <nborisov@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> [ switch to BTRFS_FILE_EXTENT_TYPES, similar to what BTRFS_COMPRESS_TYPES does ] Signed-off-by: David Sterba <dsterba@suse.com> Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'include/uapi')
-rw-r--r--include/uapi/linux/btrfs_tree.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/include/uapi/linux/btrfs_tree.h b/include/uapi/linux/btrfs_tree.h
index 7115838fbf2a..38ab0e06259a 100644
--- a/include/uapi/linux/btrfs_tree.h
+++ b/include/uapi/linux/btrfs_tree.h
@@ -734,6 +734,7 @@ struct btrfs_balance_item {
#define BTRFS_FILE_EXTENT_INLINE 0
#define BTRFS_FILE_EXTENT_REG 1
#define BTRFS_FILE_EXTENT_PREALLOC 2
+#define BTRFS_FILE_EXTENT_TYPES 2
struct btrfs_file_extent_item {
/*