Skip to contentSkip to conversation

ext4: Make ext4_ext_convert_to_initialized() return proper number of blocks

PATCH Applied Jan Kara 2 participants 2 messages Oct 22, 2014 – Oct 30, 2014 ext4 file system

lore
Share & tools
lore

Jan Kara

author reviewer
#0 lore raw

PATCH 1/1 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

---
 fs/ext4/extents.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
fs/ext4/extents.c +0 -4
index 37043d0b2be8..0b16fb4c06d3 100644
@@ -3603,11 +3603,10 @@ static int ext4_ext_convert_to_initialized(handle_t *handle,
 		}
 	}
 
-	allocated = ext4_split_extent(handle, inode, ppath,
-				      &split_map, split_flag, flags);
-	if (allocated < 0)
-		err = allocated;
maintainer Applied
#1 lore raw
Quoted 9 lines · Jan Kara

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

Applied, thanks.

- Ted