aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/vfio
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2012-08-27 12:14:05 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2012-09-26 21:10:09 -0400
commit1d3653a79c4eedf5d6eaaa7328b1d134012b2509 (patch)
tree3514e79f7ccf9df3c3435e02cdb940c4dd6bbe79 /drivers/vfio
parent8319aa9127a1282b24c3ece473a058d246f35b0d (diff)
switch vfio_group_set_container() to fget_light()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'drivers/vfio')
-rw-r--r--drivers/vfio/vfio.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/vfio/vfio.c b/drivers/vfio/vfio.c
index 17830c9c7cc..91bcd97d306 100644
--- a/drivers/vfio/vfio.c
+++ b/drivers/vfio/vfio.c
@@ -1017,18 +1017,18 @@ static int vfio_group_set_container(struct vfio_group *group, int container_fd)
1017 struct file *filep; 1017 struct file *filep;
1018 struct vfio_container *container; 1018 struct vfio_container *container;
1019 struct vfio_iommu_driver *driver; 1019 struct vfio_iommu_driver *driver;
1020 int ret = 0; 1020 int ret = 0, fput_needed;
1021 1021
1022 if (atomic_read(&group->container_users)) 1022 if (atomic_read(&group->container_users))
1023 return -EINVAL; 1023 return -EINVAL;
1024 1024
1025 filep = fget(container_fd); 1025 filep = fget_light(container_fd, &fput_needed);
1026 if (!filep) 1026 if (!filep)
1027 return -EBADF; 1027 return -EBADF;
1028 1028
1029 /* Sanity check, is this really our fd? */ 1029 /* Sanity check, is this really our fd? */
1030 if (filep->f_op != &vfio_fops) { 1030 if (filep->f_op != &vfio_fops) {
1031 fput(filep); 1031 fput_light(filep, fput_needed);
1032 return -EINVAL; 1032 return -EINVAL;
1033 } 1033 }
1034 1034
@@ -1054,7 +1054,7 @@ static int vfio_group_set_container(struct vfio_group *group, int container_fd)
1054 1054
1055unlock_out: 1055unlock_out:
1056 mutex_unlock(&container->group_lock); 1056 mutex_unlock(&container->group_lock);
1057 fput(filep); 1057 fput_light(filep, fput_needed);
1058 1058
1059 return ret; 1059 return ret;
1060} 1060}