Re: [PATCH] ovl: fix creds leak in copy up error path

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

 



On Tue, May 16, 2017 at 7:45 AM, Amir Goldstein <amir73il@xxxxxxxxx> wrote:
> Fixes: 42f269b92540 ("ovl: rearrange code in ovl_copy_up_locked()")
> Cc: <stable@xxxxxxxxxxxxxxx> # v4.11
> Signed-off-by: Amir Goldstein <amir73il@xxxxxxxxx>

Thanks, applied.

Miklos


> ---
>  fs/overlayfs/copy_up.c | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
>
> Miklos,
>
> Found that fall out while trying to 'simplify' this function. (see WIP at
> https://github.com/amir73il/linux/commits/ovl-index-dir).
>
> Amir.
>
> diff --git a/fs/overlayfs/copy_up.c b/fs/overlayfs/copy_up.c
> index 9008ab9..061a844 100644
> --- a/fs/overlayfs/copy_up.c
> +++ b/fs/overlayfs/copy_up.c
> @@ -343,12 +343,13 @@ static int ovl_copy_up_locked(struct dentry *workdir, struct dentry *upperdir,
>                 temp = ovl_do_tmpfile(upperdir, stat->mode);
>         else
>                 temp = ovl_lookup_temp(workdir, dentry);
> -       err = PTR_ERR(temp);
> -       if (IS_ERR(temp))
> -               goto out1;
> -
>         err = 0;
> -       if (!tmpfile)
> +       if (IS_ERR(temp)) {
> +               err = PTR_ERR(temp);
> +               temp = NULL;
> +       }
> +
> +       if (!err && !tmpfile)
>                 err = ovl_create_real(wdir, temp, &cattr, NULL, true);
>
>         if (new_creds) {
> --
> 2.7.4
>
--
To unsubscribe from this list: send the line "unsubscribe linux-unionfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[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