mirror of
https://github.com/torvalds/linux.git
synced 2024-11-11 22:51:42 +00:00
ext2: Fix memory leak when truncate races ext2_get_blocks
Buffer heads referencing indirect blocks may not be released if the file is truncated at the right time. This happens because ext2_get_branch() returns NULL when it finds the whole chain of indirect blocks already set, and when truncate alters the chain this value of NULL is treated as the address of the last head to be released. Handle this in the same way as it's done after the got_it label. Signed-off-by: Ernesto A. Fernández <ernesto.mnd.fernandez@gmail.com> Signed-off-by: Jan Kara <jack@suse.cz>
This commit is contained in:
parent
08db141b53
commit
4d9bcaddac
@ -659,6 +659,7 @@ static int ext2_get_blocks(struct inode *inode,
|
||||
*/
|
||||
err = -EAGAIN;
|
||||
count = 0;
|
||||
partial = chain + depth - 1;
|
||||
break;
|
||||
}
|
||||
blk = le32_to_cpu(*(chain[depth-1].p + count));
|
||||
|
Loading…
Reference in New Issue
Block a user