• zhangyi (F)'s avatar
    ext4: brelse all indirect buffer in ext4_ind_remove_space() · 33fb4996
    zhangyi (F) authored
    commit 674a2b27234d1b7afcb0a9162e81b2e53aeef217 upstream.
    
    All indirect buffers get by ext4_find_shared() should be released no
    mater the branch should be freed or not. But now, we forget to release
    the lower depth indirect buffers when removing space from the same
    higher depth indirect block. It will lead to buffer leak and futher
    more, it may lead to quota information corruption when using old quota,
    consider the following case.
    
     - Create and mount an empty ext4 filesystem without extent and quota
       features,
     - quotacheck and enable the user & group quota,
     - Create some files and write some data to them, and then punch hole
       to some files of them, it may trigger the buffer leak problem
       mentioned above.
     - Disable quota and run quotacheck again, it will create two new
       aquota files and write the checked quota information to them, which
       probably may reuse the freed indirect block(the buffer and page
       cache was not freed) as data block.
     - Enable quota again, it will invoke
       vfs_load_quota_inode()->invalidate_bdev() to try to clean unused
       buffers and pagecache. Unfortunately, because of the buffer of quota
       data block is still referenced, quota code cannot read the up to date
       quota info from the device and lead to quota information corruption.
    
    This problem can be reproduced by xfstests generic/231 on ext3 file
    system or ext4 file system without extent and quota features.
    
    This patch fix this problem by releasing the missing indirect buffers,
    in ext4_ind_remove_space().
    Reported-by: 's avatarHulk Robot <hulkci@huawei.com>
    Signed-off-by: 's avatarzhangyi (F) <yi.zhang@huawei.com>
    Signed-off-by: 's avatarTheodore Ts'o <tytso@mit.edu>
    Reviewed-by: 's avatarJan Kara <jack@suse.cz>
    Cc: stable@kernel.org
    Signed-off-by: 's avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    33fb4996
Name
Last commit
Last update
Documentation Loading commit data...
arch Loading commit data...
block Loading commit data...
certs Loading commit data...
crypto Loading commit data...
drivers Loading commit data...
firmware Loading commit data...
fs Loading commit data...
include Loading commit data...
init Loading commit data...
ipc Loading commit data...
kernel Loading commit data...
lib Loading commit data...
mm Loading commit data...
net Loading commit data...
samples Loading commit data...
scripts Loading commit data...
security Loading commit data...
sound Loading commit data...
tools Loading commit data...
usr Loading commit data...
virt Loading commit data...
.cocciconfig Loading commit data...
.get_maintainer.ignore Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
.mailmap Loading commit data...
COPYING Loading commit data...
CREDITS Loading commit data...
Kbuild Loading commit data...
Kconfig Loading commit data...
MAINTAINERS Loading commit data...
Makefile Loading commit data...
README Loading commit data...