linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] btrfs: Fix an error handling path in btrfs_rename()
@ 2022-12-12 20:14 Christophe JAILLET
  2022-12-12 20:19 ` Sweet Tea Dorminy
  2022-12-13 18:41 ` David Sterba
  0 siblings, 2 replies; 3+ messages in thread
From: Christophe JAILLET @ 2022-12-12 20:14 UTC (permalink / raw)
  To: Chris Mason, Josef Bacik, David Sterba, Sweet Tea Dorminy
  Cc: linux-kernel, kernel-janitors, Christophe JAILLET, linux-btrfs

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")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 fs/btrfs/inode.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 8bcad9940154..2ead7b1bdbaf 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;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] btrfs: Fix an error handling path in btrfs_rename()
  2022-12-12 20:14 [PATCH] btrfs: Fix an error handling path in btrfs_rename() Christophe JAILLET
@ 2022-12-12 20:19 ` Sweet Tea Dorminy
  2022-12-13 18:41 ` David Sterba
  1 sibling, 0 replies; 3+ messages in thread
From: Sweet Tea Dorminy @ 2022-12-12 20:19 UTC (permalink / raw)
  To: Christophe JAILLET, Chris Mason, Josef Bacik, David Sterba
  Cc: linux-kernel, kernel-janitors, linux-btrfs



On 12/12/22 15:14, Christophe JAILLET wrote:
> 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")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Sweet Tea Dorminy <sweettea-kernel@dorminy.me>

Thanks for catching this.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] btrfs: Fix an error handling path in btrfs_rename()
  2022-12-12 20:14 [PATCH] btrfs: Fix an error handling path in btrfs_rename() Christophe JAILLET
  2022-12-12 20:19 ` Sweet Tea Dorminy
@ 2022-12-13 18:41 ` David Sterba
  1 sibling, 0 replies; 3+ messages in thread
From: David Sterba @ 2022-12-13 18:41 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: Chris Mason, Josef Bacik, David Sterba, Sweet Tea Dorminy,
	linux-kernel, kernel-janitors, linux-btrfs

On Mon, Dec 12, 2022 at 09:14:17PM +0100, Christophe JAILLET wrote:
> 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")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

Added to misc-next, thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-12-13 18:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-12 20:14 [PATCH] btrfs: Fix an error handling path in btrfs_rename() Christophe JAILLET
2022-12-12 20:19 ` Sweet Tea Dorminy
2022-12-13 18:41 ` David Sterba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).