aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4/extents.c
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2018-06-14 12:55:10 -0400
committerTheodore Ts'o <tytso@mit.edu>2018-06-14 12:55:10 -0400
commitbc890a60247171294acc0bd67d211fa4b88d40ba (patch)
treecb1aeb05ac0a8eb30f12d49c68da6f1a65187bc2 /fs/ext4/extents.c
parent8844618d8aa7a9973e7b527d038a2a589665002c (diff)
downloadlinux-bc890a60247171294acc0bd67d211fa4b88d40ba.tar.gz
ext4: verify the depth of extent tree in ext4_find_extent()
If there is a corupted file system where the claimed depth of the extent tree is -1, this can cause a massive buffer overrun leading to sadness. This addresses CVE-2018-10877. https://bugzilla.kernel.org/show_bug.cgi?id=199417 Signed-off-by: Theodore Ts'o <tytso@mit.edu> Cc: stable@kernel.org
Diffstat (limited to 'fs/ext4/extents.c')
-rw-r--r--fs/ext4/extents.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index c969275ce3ee7..08226f72b7ee4 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -869,6 +869,12 @@ ext4_find_extent(struct inode *inode, ext4_lblk_t block,
eh = ext_inode_hdr(inode);
depth = ext_depth(inode);
+ if (depth < 0 || depth > EXT4_MAX_EXTENT_DEPTH) {
+ EXT4_ERROR_INODE(inode, "inode has invalid extent depth: %d",
+ depth);
+ ret = -EFSCORRUPTED;
+ goto err;
+ }
if (path) {
ext4_ext_drop_refs(path);