summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>2022-12-12 21:14:17 +0100
committerDavid Sterba <dsterba@suse.com>2022-12-15 19:16:47 +0100
commitabe3bf7425fb695a9b37394af18b9ea58a800802 (patch)
treeeb39dd53caf8fd794a6a139265e81bfb24cd1c90 /fs
parentb7af0635c87ff78d6bd523298ab7471f9ffd3ce5 (diff)
downloadlinux-stable-abe3bf7425fb695a9b37394af18b9ea58a800802.tar.gz
linux-stable-abe3bf7425fb695a9b37394af18b9ea58a800802.tar.bz2
linux-stable-abe3bf7425fb695a9b37394af18b9ea58a800802.zip
btrfs: fix an error handling path in btrfs_rename()
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 <sweettea-kernel@dorminy.me> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/inode.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 905ea19df125..bfcbe64eb8b3 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -9377,8 +9377,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;