[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <F36C0C80-DAF3-4D8F-8EA3-5209E8FB5BE3@dubeyko.com>
Date: Fri, 26 Jan 2024 18:02:34 +0300
From: Viacheslav Dubeyko <slava@...eyko.com>
To: Zhipeng Lu <alexious@....edu.cn>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Desmond Cheong Zhi Xi <desmondcheongzx@...il.com>,
linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] hfs: fix a memleak in hfs_find_init
> On 22 Jan 2024, at 20:27, Zhipeng Lu <alexious@....edu.cn> wrote:
>
> When the switch statment goes to default and return an error, ptr should
> be freed since it is allocated in hfs_find_init.
>
Do you have any memory leaks report? Could you share it in the comments?
Which use-case reproduces the issue? It will be easier to review the fix
If you can share the path of reproduction.
Thanks,
Slava.
> Fixes: b3b2177a2d79 ("hfs: add lock nesting notation to hfs_find_init")
> Signed-off-by: Zhipeng Lu <alexious@....edu.cn>
> ---
> fs/hfs/bfind.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/fs/hfs/bfind.c b/fs/hfs/bfind.c
> index ef9498a6e88a..7aa3b9aba4d1 100644
> --- a/fs/hfs/bfind.c
> +++ b/fs/hfs/bfind.c
> @@ -36,6 +36,7 @@ int hfs_find_init(struct hfs_btree *tree, struct hfs_find_data *fd)
> mutex_lock_nested(&tree->tree_lock, ATTR_BTREE_MUTEX);
> break;
> default:
> + kfree(fd->search_key);
> return -EINVAL;
> }
> return 0;
> --
> 2.34.1
>
Powered by blists - more mailing lists