linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Xu, Yanfei" <yanfei.xu@windriver.com>
To: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	Alexander Viro <viro@zeniv.linux.org.uk>
Subject: Re: [PATCH] userfaultfd: avoid the duplicated release for userfaultfd_ctx
Date: Sun, 19 Jul 2020 21:58:34 +0800	[thread overview]
Message-ID: <e3cbdb26-9bfb-55e7-c9a7-deb7f8831754@windriver.com> (raw)
In-Reply-To: <20200714161203.31879-1-yanfei.xu@windriver.com>

ping Al Viro

Could you please help to review this patch? Thanks a lot.

Yanfei

On 7/15/20 12:12 AM, yanfei.xu@windriver.com wrote:
> From: Yanfei Xu <yanfei.xu@windriver.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@syzkaller.appspotmail.com
> Signed-off-by: Yanfei Xu <yanfei.xu@windriver.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);
> 

  parent reply	other threads:[~2020-07-19 13:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-14 16:12 [PATCH] userfaultfd: avoid the duplicated release for userfaultfd_ctx yanfei.xu
2020-07-15  1:41 ` Xu, Yanfei
2020-07-19 13:58 ` Xu, Yanfei [this message]
2020-07-19 16:57   ` Al Viro
2020-07-20  1:34     ` Xu, Yanfei
2020-07-22  0:09       ` Suren Baghdasaryan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e3cbdb26-9bfb-55e7-c9a7-deb7f8831754@windriver.com \
    --to=yanfei.xu@windriver.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).