diff options
author | Curt Wohlgemuth <curtw@google.com> | 2011-10-26 04:38:59 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2011-10-26 04:38:59 -0400 |
commit | 6f8ff537266ee5396c920fb0c842a21df3055ff3 (patch) | |
tree | a024979a4e8f718289e9bf36fc165b96b68d6209 /fs/ext4 | |
parent | f85b287a01237857a50c93868231f7e831581a27 (diff) | |
download | blackbird-obmc-linux-6f8ff537266ee5396c920fb0c842a21df3055ff3.tar.gz blackbird-obmc-linux-6f8ff537266ee5396c920fb0c842a21df3055ff3.zip |
ext4: handle NULL p_ext in ext4_ext_next_allocated_block()
In ext4_ext_next_allocated_block(), the path[depth] might
have a p_ext that is NULL -- see ext4_ext_binsearch(). In
such a case, dereferencing it will crash the machine.
This patch checks for p_ext == NULL in
ext4_ext_next_allocated_block() before dereferencinging it.
Tested using a hand-crafted an inode with eh_entries == 0 in
an extent block, verified that running FIEMAP on it crashes
without this patch, works fine with it.
Signed-off-by: Curt Wohlgemuth <curtw@google.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4')
-rw-r--r-- | fs/ext4/extents.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index 02a4d80573a1..797b63b59740 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c @@ -1392,7 +1392,8 @@ ext4_ext_next_allocated_block(struct ext4_ext_path *path) while (depth >= 0) { if (depth == path->p_depth) { /* leaf */ - if (path[depth].p_ext != + if (path[depth].p_ext && + path[depth].p_ext != EXT_LAST_EXTENT(path[depth].p_hdr)) return le32_to_cpu(path[depth].p_ext[1].ee_block); } else { |