summaryrefslogtreecommitdiffstats
path: root/arch/mips/kernel/cpu-probe.c
diff options
context:
space:
mode:
authorzhangyi (F) <yi.zhang@huawei.com>2019-08-28 11:13:24 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-10-07 18:59:23 +0200
commitb67fd3bfeec52d0ee5c057b139814ac28a340f76 (patch)
tree43962491ae45a5ec26aa89cd511d282bee3e8f09 /arch/mips/kernel/cpu-probe.c
parentad849db7534bfc6cd550d2706485570fb0e8cae7 (diff)
downloadlinux-stable-b67fd3bfeec52d0ee5c057b139814ac28a340f76.tar.gz
linux-stable-b67fd3bfeec52d0ee5c057b139814ac28a340f76.tar.bz2
linux-stable-b67fd3bfeec52d0ee5c057b139814ac28a340f76.zip
ext4: fix potential use after free after remounting with noblock_validity
[ Upstream commit 7727ae52975d4f4ef7ff69ed8e6e25f6a4168158 ] Remount process will release system zone which was allocated before if "noblock_validity" is specified. If we mount an ext4 file system to two mountpoints with default mount options, and then remount one of them with "noblock_validity", it may trigger a use after free problem when someone accessing the other one. # mount /dev/sda foo # mount /dev/sda bar User access mountpoint "foo" | Remount mountpoint "bar" | ext4_map_blocks() | ext4_remount() check_block_validity() | ext4_setup_system_zone() ext4_data_block_valid() | ext4_release_system_zone() | free system_blks rb nodes access system_blks rb nodes | trigger use after free | This problem can also be reproduced by one mountpint, At the same time, add_system_zone() can get called during remount as well so there can be racing ext4_data_block_valid() reading the rbtree at the same time. This patch add RCU to protect system zone from releasing or building when doing a remount which inverse current "noblock_validity" mount option. It assign the rbtree after the whole tree was complete and do actual freeing after rcu grace period, avoid any intermediate state. Reported-by: syzbot+1e470567330b7ad711d5@syzkaller.appspotmail.com Signed-off-by: zhangyi (F) <yi.zhang@huawei.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu> Reviewed-by: Jan Kara <jack@suse.cz> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'arch/mips/kernel/cpu-probe.c')
0 files changed, 0 insertions, 0 deletions