lkml.org 
[lkml]   [2022]   [Sep]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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.

\
 
 \ /
  Last update: 2022-09-27 03:38    [W:0.041 / U:0.384 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site