Commit 1d3653a7 authored by Al Viro's avatar Al Viro

switch vfio_group_set_container() to fget_light()

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 8319aa91
...@@ -1017,18 +1017,18 @@ static int vfio_group_set_container(struct vfio_group *group, int container_fd) ...@@ -1017,18 +1017,18 @@ static int vfio_group_set_container(struct vfio_group *group, int container_fd)
struct file *filep; struct file *filep;
struct vfio_container *container; struct vfio_container *container;
struct vfio_iommu_driver *driver; struct vfio_iommu_driver *driver;
int ret = 0; int ret = 0, fput_needed;
if (atomic_read(&group->container_users)) if (atomic_read(&group->container_users))
return -EINVAL; return -EINVAL;
filep = fget(container_fd); filep = fget_light(container_fd, &fput_needed);
if (!filep) if (!filep)
return -EBADF; return -EBADF;
/* Sanity check, is this really our fd? */ /* Sanity check, is this really our fd? */
if (filep->f_op != &vfio_fops) { if (filep->f_op != &vfio_fops) {
fput(filep); fput_light(filep, fput_needed);
return -EINVAL; return -EINVAL;
} }
...@@ -1054,7 +1054,7 @@ static int vfio_group_set_container(struct vfio_group *group, int container_fd) ...@@ -1054,7 +1054,7 @@ static int vfio_group_set_container(struct vfio_group *group, int container_fd)
unlock_out: unlock_out:
mutex_unlock(&container->group_lock); mutex_unlock(&container->group_lock);
fput(filep); fput_light(filep, fput_needed);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment