From: Christophe JAILLET Date: Mon, 12 Dec 2022 20:14:17 +0000 (+0100) Subject: btrfs: fix an error handling path in btrfs_rename() X-Git-Url: https://git.baikalelectronics.ru/sdk/?a=commitdiff_plain;h=6d05a1a7a484f1ff1459c4f5b853d94f839b26b0;p=kernel.git btrfs: fix an error handling path in btrfs_rename() commit abe3bf7425fb695a9b37394af18b9ea58a800802 upstream. If new_whiteout_inode() fails, some resources need to be freed. Add the missing goto to the error handling path. Fixes: ab3c5c18e8fa ("btrfs: setup qstr from dentrys using fscrypt helper") Reviewed-by: Sweet Tea Dorminy Signed-off-by: Christophe JAILLET Reviewed-by: David Sterba Signed-off-by: David Sterba Signed-off-by: Greg Kroah-Hartman --- diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 47c5be597368b..4063447217f92 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -9400,8 +9400,10 @@ static int btrfs_rename(struct user_namespace *mnt_userns, if (flags & RENAME_WHITEOUT) { whiteout_args.inode = new_whiteout_inode(mnt_userns, old_dir); - if (!whiteout_args.inode) - return -ENOMEM; + if (!whiteout_args.inode) { + ret = -ENOMEM; + goto out_fscrypt_names; + } ret = btrfs_new_inode_prepare(&whiteout_args, &trans_num_items); if (ret) goto out_whiteout_inode;