[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1a463530-107d-0893-cecf-87ba42ebdbf6@windriver.com>
Date: Wed, 15 Jul 2020 09:41:29 +0800
From: "Xu, Yanfei" <yanfei.xu@...driver.com>
To: linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
Alexander Viro <viro@...iv.linux.org.uk>
Subject: Re: [PATCH] userfaultfd: avoid the duplicated release for
userfaultfd_ctx
Add maintainer Alexander Viro :)
On 7/15/20 12:12 AM, yanfei.xu@...driver.com wrote:
> From: Yanfei Xu <yanfei.xu@...driver.com>
>
> when get_unused_fd_flags gets failure, userfaultfd_ctx_cachep will
> be freed by userfaultfd_fops's release function which is the
> userfaultfd_release. So we could return directly after fput().
>
> userfaultfd_release()->userfaultfd_ctx_put(ctx)
>
> Fixes: d08ac70b1e0d (Wire UFFD up to SELinux)
> Reported-by: syzbot+75867c44841cb6373570@...kaller.appspotmail.com
> Signed-off-by: Yanfei Xu <yanfei.xu@...driver.com>
> ---
> fs/userfaultfd.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/userfaultfd.c b/fs/userfaultfd.c
> index 3a4d6ac5a81a..e98317c15530 100644
> --- a/fs/userfaultfd.c
> +++ b/fs/userfaultfd.c
> @@ -2049,7 +2049,7 @@ SYSCALL_DEFINE1(userfaultfd, int, flags)
> fd = get_unused_fd_flags(O_RDONLY | O_CLOEXEC);
> if (fd < 0) {
> fput(file);
> - goto out;
> + return fd;
> }
>
> ctx->owner = file_inode(file);
>
Powered by blists - more mailing lists