diff options
author | Dmitry Monakhov <dmonakhov@openvz.org> | 2014-04-13 15:05:42 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2014-04-13 15:05:42 -0400 |
commit | 8dc79ec4c0537e1b83c0739af82a7babefb30012 (patch) | |
tree | f05bb659846f3643941fe2ddd4faf96a5cb494bb | |
parent | e2cbd587418251bb73c4c1e8e2c7c1816d7a98d9 (diff) |
ext4: fix error handling in ext4_ext_shift_extents
Fix error handling by adding some. :-)
Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
-rw-r--r-- | fs/ext4/extents.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index 96e0a4bc8fa..38be06354b8 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c @@ -5314,11 +5314,18 @@ ext4_ext_shift_extents(struct inode *inode, handle_t *handle, * enough to accomodate the shift. */ path = ext4_ext_find_extent(inode, start - 1, NULL, 0); + if (IS_ERR(path)) + return PTR_ERR(path); depth = path->p_depth; extent = path[depth].p_ext; - ex_start = le32_to_cpu(extent->ee_block); - ex_end = le32_to_cpu(extent->ee_block) + + if (extent) { + ex_start = le32_to_cpu(extent->ee_block); + ex_end = le32_to_cpu(extent->ee_block) + ext4_ext_get_actual_len(extent); + } else { + ex_start = 0; + ex_end = 0; + } ext4_ext_drop_refs(path); kfree(path); |