diff options
author | Eric Whitney <enwlinux@gmail.com> | 2014-02-19 18:52:39 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-04-26 20:15:35 -0400 |
commit | cbe099ed98247f60f18a828edd1b0bd07560b460 (patch) | |
tree | 59e3ab9fc7258cf0f88f51e1a45671fb9cae19ab /fs | |
parent | 19fc37ed7b9e8cdde28597adb9714d6f863985b4 (diff) |
ext4: fix error return from ext4_ext_handle_uninitialized_extents()
commit ce37c42919608e96ade3748fe23c3062a0a966c5 upstream.
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
-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 a2b625e279db..141d0fce318d 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c | |||
@@ -4032,7 +4032,7 @@ int ext4_ext_map_blocks(handle_t *handle, struct inode *inode, | |||
4032 | struct ext4_extent newex, *ex, *ex2; | 4032 | struct ext4_extent newex, *ex, *ex2; |
4033 | struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb); | 4033 | struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb); |
4034 | ext4_fsblk_t newblock = 0; | 4034 | ext4_fsblk_t newblock = 0; |
4035 | int free_on_err = 0, err = 0, depth; | 4035 | int free_on_err = 0, err = 0, depth, ret; |
4036 | unsigned int allocated = 0, offset = 0; | 4036 | unsigned int allocated = 0, offset = 0; |
4037 | unsigned int allocated_clusters = 0; | 4037 | unsigned int allocated_clusters = 0; |
4038 | struct ext4_allocation_request ar; | 4038 | struct ext4_allocation_request ar; |
@@ -4093,9 +4093,13 @@ int ext4_ext_map_blocks(handle_t *handle, struct inode *inode, | |||
4093 | if (!ext4_ext_is_uninitialized(ex)) | 4093 | if (!ext4_ext_is_uninitialized(ex)) |
4094 | goto out; | 4094 | goto out; |
4095 | 4095 | ||
4096 | allocated = ext4_ext_handle_uninitialized_extents( | 4096 | ret = ext4_ext_handle_uninitialized_extents( |
4097 | handle, inode, map, path, flags, | 4097 | handle, inode, map, path, flags, |
4098 | allocated, newblock); | 4098 | allocated, newblock); |
4099 | if (ret < 0) | ||
4100 | err = ret; | ||
4101 | else | ||
4102 | allocated = ret; | ||
4099 | goto out3; | 4103 | goto out3; |
4100 | } | 4104 | } |
4101 | } | 4105 | } |