diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2012-08-28 18:52:22 +0200 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-09-27 04:20:08 +0200 |
commit | 2903ff019b346ab8d36ebbf54853c3aaf6590608 (patch) | |
tree | 962d94054765bb37bc00e977c3036e65c5fd91fe /drivers/vfio | |
parent | new helpers: fdget()/fdput() (diff) | |
download | linux-2903ff019b346ab8d36ebbf54853c3aaf6590608.tar.xz linux-2903ff019b346ab8d36ebbf54853c3aaf6590608.zip |
switch simple cases of fget_light to fdget
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'drivers/vfio')
-rw-r--r-- | drivers/vfio/vfio.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/drivers/vfio/vfio.c b/drivers/vfio/vfio.c index 91bcd97d3061..56097c6d072d 100644 --- a/drivers/vfio/vfio.c +++ b/drivers/vfio/vfio.c @@ -1014,25 +1014,25 @@ static void vfio_group_try_dissolve_container(struct vfio_group *group) static int vfio_group_set_container(struct vfio_group *group, int container_fd) { - struct file *filep; + struct fd f; struct vfio_container *container; struct vfio_iommu_driver *driver; - int ret = 0, fput_needed; + int ret = 0; if (atomic_read(&group->container_users)) return -EINVAL; - filep = fget_light(container_fd, &fput_needed); - if (!filep) + f = fdget(container_fd); + if (!f.file) return -EBADF; /* Sanity check, is this really our fd? */ - if (filep->f_op != &vfio_fops) { - fput_light(filep, fput_needed); + if (f.file->f_op != &vfio_fops) { + fdput(f); return -EINVAL; } - container = filep->private_data; + container = f.file->private_data; WARN_ON(!container); /* fget ensures we don't race vfio_release */ mutex_lock(&container->group_lock); @@ -1054,8 +1054,7 @@ static int vfio_group_set_container(struct vfio_group *group, int container_fd) unlock_out: mutex_unlock(&container->group_lock); - fput_light(filep, fput_needed); - + fdput(f); return ret; } |