diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index 578769f1090684dbf63f5ca4b206557832b25c01..6edab0ef28fd83f078c489266a64606582532312 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c @@ -508,6 +508,10 @@ static int __ext4_ext_check(const char *function, unsigned int line, error_msg = "invalid eh_entries"; goto corrupted; } + if (unlikely((eh->eh_entries == 0) && (depth > 0))) { + error_msg = "eh_entries is 0 but eh_depth is > 0"; + goto corrupted; + } if (!ext4_valid_extent_entries(inode, eh, lblk, &pblk, depth)) { error_msg = "invalid extent entries"; goto corrupted;