]> git.baikalelectronics.ru Git - kernel.git/commit
ext2: Fix memory leak when truncate races ext2_get_blocks
authorErnesto A. Fernández <ernesto.mnd.fernandez@gmail.com>
Sat, 24 Jun 2017 00:37:21 +0000 (21:37 -0300)
committerJan Kara <jack@suse.cz>
Thu, 13 Jul 2017 11:45:08 +0000 (13:45 +0200)
commit99c94d83365fd67d10b028622972e0d0b7765df5
treee2a78e2ba45bf86d738e409ee1573822ddc36a11
parent1921315e0199d56aaaace2adc0d5e3e02d6fd85e
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>
fs/ext2/inode.c