lkml.org 
[lkml]   [2023]   [Nov]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] ovl: fix memory leak in ovl_parse_param
On Sun, Nov 12, 2023 at 12:35 PM Edward Adam Davis <eadavis@qq.com> wrote:
>
> After failing to parse parameters in ovl_parse_param_lowerdir(), it is
> necessary to update ctx->nr with the correct nr before using
> ovl_reset_lowerdirs() to release l->name.
>
> Reported-and-tested-by: syzbot+26eedf3631650972f17c@syzkaller.appspotmail.com
> Signed-off-by: Edward Adam Davis <eadavis@qq.com>
> ---
> fs/overlayfs/params.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/fs/overlayfs/params.c b/fs/overlayfs/params.c
> index ddab9ea267d1..1f73f0173015 100644
> --- a/fs/overlayfs/params.c
> +++ b/fs/overlayfs/params.c
> @@ -530,6 +530,7 @@ static int ovl_parse_param_lowerdir(const char *name, struct fs_context *fc)
> return 0;
>
> out_put:
> + ctx->nr = nr;
> ovl_reset_lowerdirs(ctx);
>
> out_err:
> --
> 2.25.1
>

Thanks for the patch!

I prefer to fix it by eliminating the local vars instead of
syncing with them:

I've kept your commit message and tagged you as Co-authored-by:
https://github.com/amir73il/linux/commit/97d58994e880ccb19e1b9b935928538903fca41c

Thanks,
Amir.

\
 
 \ /
  Last update: 2023-11-20 13:57    [W:0.043 / U:0.480 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site