[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <YzJT0bzUz+ACo2vA@ZenIV>
Date: Tue, 27 Sep 2022 02:37:21 +0100
From: Al Viro <viro@...iv.linux.org.uk>
To: tomorrow Wang (王德明) <wangdeming@...pur.com>
Cc: "jgg@...dia.com" <jgg@...dia.com>,
"pbonzini@...hat.com" <pbonzini@...hat.com>,
"kvm@...r.kernel.org" <kvm@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] vfio: Use filp instead of fd
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.
Powered by blists - more mailing lists