[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <367f977b-9c74-486f-9a27-75a8a7ea50ef@gmx.com>
Date: Tue, 22 Apr 2025 05:42:44 +0930
From: Qu Wenruo <quwenruo.btrfs@....com>
To: Penglei Jiang <superman.xpt@...il.com>
Cc: clm@...com, dsterba@...e.com, josef@...icpanda.com,
linux-btrfs@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] btrfs: fix the resource leak issue in btrfs_iget()
在 2025/4/22 01:10, Penglei Jiang 写道:
> When btrfs_iget() returns an error, it does not use iget_failed() to mark
> and release the inode. Now, we add the missing iget_failed() call.
>
> Fixes: 7c855e16ab72 ("btrfs: remove conditional path allocation in btrfs_read_locked_inode()")
> Reported-by: Penglei Jiang <superman.xpt@...il.com>
> Signed-off-by: Penglei Jiang <superman.xpt@...il.com>
> ---
> V1 -> V2: Fixed the issue with multiple calls to btrfs_iget()
Looks good to me.
Reviewed-by: Qu Wenruo <wqu@...e.com>
Thanks,
Qu
>
> fs/btrfs/inode.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
> index cc67d1a2d611..1cbf92ca748d 100644
> --- a/fs/btrfs/inode.c
> +++ b/fs/btrfs/inode.c
> @@ -5681,8 +5681,10 @@ struct btrfs_inode *btrfs_iget(u64 ino, struct btrfs_root *root)
> return inode;
>
> path = btrfs_alloc_path();
> - if (!path)
> + if (!path) {
> + iget_failed(&inode->vfs_inode);
> return ERR_PTR(-ENOMEM);
> + }
>
> ret = btrfs_read_locked_inode(inode, path);
> btrfs_free_path(path);
Powered by blists - more mailing lists