aboutsummaryrefslogtreecommitdiff
path: root/fs/ext4/inode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ext4/inode.c')
-rw-r--r--fs/ext4/inode.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index dc9f0ecd8f4..55d4f461992 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -481,6 +481,11 @@ int ext4_map_blocks(handle_t *handle, struct inode *inode,
ext_debug("ext4_map_blocks(): inode %lu, flag %d, max_blocks %u,"
"logical block %lu\n", inode->i_ino, flags, map->m_len,
(unsigned long) map->m_lblk);
+
+ /* We can handle the block number less than EXT_MAX_BLOCKS */
+ if (unlikely(map->m_lblk >= EXT_MAX_BLOCKS))
+ return -EIO;
+
/*
* Try to see if we can get the block without requesting a new
* file system block.