Re: [PATCH] ovl: fix memory leak in ovl_parse_param

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Nov 12, 2023 at 12:35 PM Edward Adam Davis <eadavis@xxxxxx> 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@xxxxxxxxxxxxxxxxxxxxxxxxx
> Signed-off-by: Edward Adam Davis <eadavis@xxxxxx>
> ---
>  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.




[Index of Archives]     [Linux Filesystems Devel]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux