Commit ae9e9c6aeea6f91ccb4fb369d7dd8f1a8b5f6a58
Committed by
Theodore Ts'o
1 parent
4f879ca687
Exists in
ti-lsk-linux-4.1.y
and in
10 other branches
ext4: make ext4_ext_convert_to_initialized() return proper number of blocks
ext4_ext_convert_to_initialized() can return more blocks than are actually allocated from map->m_lblk in case where initial part of the on-disk extent is zeroed out. Luckily this doesn't have serious consequences because the caller currently uses the return value only to unmap metadata buffers. Anyway this is a data corruption/exposure problem waiting to happen so fix it. Coverity-id: 1226848 Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Showing 1 changed file with 4 additions and 5 deletions Side-by-side Diff
fs/ext4/extents.c
... | ... | @@ -3603,11 +3603,10 @@ |
3603 | 3603 | } |
3604 | 3604 | } |
3605 | 3605 | |
3606 | - allocated = ext4_split_extent(handle, inode, ppath, | |
3607 | - &split_map, split_flag, flags); | |
3608 | - if (allocated < 0) | |
3609 | - err = allocated; | |
3610 | - | |
3606 | + err = ext4_split_extent(handle, inode, ppath, &split_map, split_flag, | |
3607 | + flags); | |
3608 | + if (err > 0) | |
3609 | + err = 0; | |
3611 | 3610 | out: |
3612 | 3611 | /* If we have gotten a failure, don't zero out status tree */ |
3613 | 3612 | if (!err) |