Re: [PATCH] ovl: credential not reverted in ovl_copy_up_flags on error case

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

 



On Mon, Jun 22, 2020 at 8:24 PM youngjun <her0gyugyu@xxxxxxxxx> wrote:
>
> In "ovl_copy_up_flags" on disconnected dir case(error case),
> credential not reverted.
>
> Fixes: aa3ff3c152ff9("ovl: copy up of disconnected dentries")
> Signed-off-by: youngjun <her0gyugyu@xxxxxxxxx>
> ---
>  fs/overlayfs/copy_up.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/fs/overlayfs/copy_up.c b/fs/overlayfs/copy_up.c
> index 79dd052c7dbf..53daa54ac859 100644
> --- a/fs/overlayfs/copy_up.c
> +++ b/fs/overlayfs/copy_up.c
> @@ -906,8 +906,10 @@ int ovl_copy_up_flags(struct dentry *dentry, int flags)
>          * In this case, we will copy up lower inode to index dir without
>          * linking it to upper dir.
>          */
> -       if (WARN_ON(disconnected && d_is_dir(dentry)))
> +       if (WARN_ON(disconnected && d_is_dir(dentry))) {
> +               revert_creds(old_cred);
>                 return -EIO;
> +       }
>

It is better to move ovl_override_creds() after the WARN_ON test.
which does not require any credentials.

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