Commit 97ec433b authored by Josef Bacik's avatar Josef Bacik Committed by Long Li
Browse files

btrfs: abort in rename_exchange if we fail to insert the second ref

stable inclusion
from stable-v5.10.42
commit 0df50d47d17401f9f140dfbe752a65e5d72f9932
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/I9909R
CVE: CVE-2021-47113

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=tags/v5.10.43&id=0df50d47d17401f9f140dfbe752a65e5d72f9932



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

commit dc09ef35 upstream.

Error injection stress uncovered a problem where we'd leave a dangling
inode ref if we failed during a rename_exchange.  This happens because
we insert the inode ref for one side of the rename, and then for the
other side.  If this second inode ref insert fails we'll leave the first
one dangling and leave a corrupt file system behind.  Fix this by
aborting if we did the insert for the first inode ref.

CC: stable@vger.kernel.org # 4.9+
Signed-off-by: default avatarJosef Bacik <josef@toxicpanda.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>

Conflicts:
	fs/btrfs/inode.c

Signed-off-by: default avatarLong Li <leo.lilong@huawei.com>
parent fe60ff2c
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment