public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@zeniv.linux.org.uk>
To: "tomorrow Wang (王德明)" <wangdeming@inspur.com>
Cc: "jgg@nvidia.com" <jgg@nvidia.com>,
	"pbonzini@redhat.com" <pbonzini@redhat.com>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] vfio: Use filp instead of fd
Date: Tue, 27 Sep 2022 02:37:21 +0100	[thread overview]
Message-ID: <YzJT0bzUz+ACo2vA@ZenIV> (raw)
In-Reply-To: <0d0817a2c6a8467e83b07c91f50511fa@inspur.com>

On Tue, Sep 27, 2022 at 01:21:50AM +0000, tomorrow Wang (王德明) wrote:
> Hi
> 
> Why kvm_vfio_group_add use file.
>   
>   struct file *filp;
>   .....
>   filp = fget(fd);
> 
>   .....
>   kvg->file = filp;

This is why.  Note that you've slightly misquoted it - it's actually
either "stick into kvg->file" or "fput() it".

>   ......
>   fput(filp);

The reference we are getting here is non-transient one; it will be retained
in shared data structures after we return from function - hell, after we
return to userland.

  reply	other threads:[~2022-09-27  1:37 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-27  1:21 [PATCH] vfio: Use filp instead of fd tomorrow Wang (王德明)
2022-09-27  1:37 ` Al Viro [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-09-27  1:25 tomorrow Wang (王德明)
2022-09-26  6:54 Deming Wang
2022-09-26 13:23 ` Al Viro
2022-09-26 17:07 ` Jason Gunthorpe
2022-09-26 19:38   ` Al Viro

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=YzJT0bzUz+ACo2vA@ZenIV \
    --to=viro@zeniv.linux.org.uk \
    --cc=jgg@nvidia.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=wangdeming@inspur.com \
    /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