Commit 19f55ba1 authored by ZhangXiaoxu's avatar ZhangXiaoxu Committed by Xie XiuQi
Browse files

dm btree: fix order of block initialization in btree_split_beneath



mainline inclusion
from mainline-v5.3-rc6
commit e4f9d601
category: bugfix
bugzilla: 20701
CVE: NA

-------------------------------------------------

When btree_split_beneath() splits a node to two new children, it will
allocate two blocks: left and right.  If right block's allocation
failed, the left block will be unlocked and marked dirty.  If this
happened, the left block'ss content is zero, because it wasn't
initialized with the btree struct before the attempot to allocate the
right block.  Upon return, when flushing the left block to disk, the
validator will fail when check this block.  Then a BUG_ON is raised.

Fix this by completely initializing the left block before allocating and
initializing the right block.

Fixes: 4dcb8b57 ("dm btree: fix leak of bufio-backed block in btree_split_beneath error path")
Cc: stable@vger.kernel.org
Signed-off-by: default avatarZhangXiaoxu <zhangxiaoxu5@huawei.com>
Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
Signed-off-by: default avatarZhangXiaoxu <zhangxiaoxu5@huawei.com>
Reviewed-by: default avatarYufen Yu <yuyufen@huawei.com>
Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
parent fff3596e
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment