Skip to content

Commit

Permalink
switch vfio_group_set_container() to fget_light()
Browse files Browse the repository at this point in the history
Signed-off-by: Al Viro <[email protected]>
  • Loading branch information
Al Viro committed Sep 27, 2012
1 parent 8319aa9 commit 1d3653a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions drivers/vfio/vfio.c
Original file line number Diff line number Diff line change
Expand Up @@ -1017,18 +1017,18 @@ static int vfio_group_set_container(struct vfio_group *group, int container_fd)
struct file *filep;
struct vfio_container *container;
struct vfio_iommu_driver *driver;
int ret = 0;
int ret = 0, fput_needed;

if (atomic_read(&group->container_users))
return -EINVAL;

filep = fget(container_fd);
filep = fget_light(container_fd, &fput_needed);
if (!filep)
return -EBADF;

/* Sanity check, is this really our fd? */
if (filep->f_op != &vfio_fops) {
fput(filep);
fput_light(filep, fput_needed);
return -EINVAL;
}

Expand All @@ -1054,7 +1054,7 @@ static int vfio_group_set_container(struct vfio_group *group, int container_fd)

unlock_out:
mutex_unlock(&container->group_lock);
fput(filep);
fput_light(filep, fput_needed);

return ret;
}
Expand Down

0 comments on commit 1d3653a

Please sign in to comment.