OSDN Git Service

switch vfio_group_set_container() to fget_light()
authorAl Viro <viro@zeniv.linux.org.uk>
Mon, 27 Aug 2012 16:14:05 +0000 (12:14 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Thu, 27 Sep 2012 01:10:09 +0000 (21:10 -0400)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
drivers/vfio/vfio.c

index 17830c9..91bcd97 100644 (file)
@@ -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;
        }
 
@@ -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;
 }