diff options
author | Eric Whitney <enwlinux@gmail.com> | 2014-02-19 18:52:39 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2014-02-19 18:52:39 -0500 |
commit | ce37c42919608e96ade3748fe23c3062a0a966c5 (patch) | |
tree | 3f3c73d33866c190274bce89ba9f362016b2cbca /fs/ext4/extents.c | |
parent | 024949ec8fc165bfac8eb051e537bc303adb365f (diff) |
ext4: fix error return from ext4_ext_handle_uninitialized_extents()
Commit 3779473246 breaks the return of error codes from
ext4_ext_handle_uninitialized_extents() in ext4_ext_map_blocks(). A
portion of the patch assigns that function's signed integer return
value to an unsigned int. Consequently, negatively valued error codes
are lost and can be treated as a bogus allocated block count.
Signed-off-by: Eric Whitney <enwlinux@gmail.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Cc: stable@vger.kernel.org
Diffstat (limited to 'fs/ext4/extents.c')
-rw-r--r-- | fs/ext4/extents.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index 74bc2d549c58..9875fd0918e7 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c | |||
@@ -4128,7 +4128,7 @@ int ext4_ext_map_blocks(handle_t *handle, struct inode *inode, | |||
4128 | struct ext4_extent newex, *ex, *ex2; | 4128 | struct ext4_extent newex, *ex, *ex2; |
4129 | struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb); | 4129 | struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb); |
4130 | ext4_fsblk_t newblock = 0; | 4130 | ext4_fsblk_t newblock = 0; |
4131 | int free_on_err = 0, err = 0, depth; | 4131 | int free_on_err = 0, err = 0, depth, ret; |
4132 | unsigned int allocated = 0, offset = 0; | 4132 | unsigned int allocated = 0, offset = 0; |
4133 | unsigned int allocated_clusters = 0; | 4133 | unsigned int allocated_clusters = 0; |
4134 | struct ext4_allocation_request ar; | 4134 | struct ext4_allocation_request ar; |
@@ -4189,9 +4189,13 @@ int ext4_ext_map_blocks(handle_t *handle, struct inode *inode, | |||
4189 | if (!ext4_ext_is_uninitialized(ex)) | 4189 | if (!ext4_ext_is_uninitialized(ex)) |
4190 | goto out; | 4190 | goto out; |
4191 | 4191 | ||
4192 | allocated = ext4_ext_handle_uninitialized_extents( | 4192 | ret = ext4_ext_handle_uninitialized_extents( |
4193 | handle, inode, map, path, flags, | 4193 | handle, inode, map, path, flags, |
4194 | allocated, newblock); | 4194 | allocated, newblock); |
4195 | if (ret < 0) | ||
4196 | err = ret; | ||
4197 | else | ||
4198 | allocated = ret; | ||
4195 | goto out3; | 4199 | goto out3; |
4196 | } | 4200 | } |
4197 | } | 4201 | } |