]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
vfio: fix a missed vfio group put in vfio_pin_pages
authorYan Zhao <yan.y.zhao@intel.com>
Wed, 16 Sep 2020 02:29:27 +0000 (10:29 +0800)
committerAlex Williamson <alex.williamson@redhat.com>
Tue, 22 Sep 2020 16:56:40 +0000 (10:56 -0600)
When error occurs, need to put vfio group after a successful get.

Fixes: 95fc87b44104 ("vfio: Selective dirty page tracking if IOMMU backed device pins pages")
Signed-off-by: Yan Zhao <yan.y.zhao@intel.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
drivers/vfio/vfio.c

index 532bcaf28c11dc88a67d51da64cdfc185db11406..2151bc7f87ab15d2ab506bc0aa945d265430b20e 100644 (file)
@@ -1949,8 +1949,10 @@ int vfio_pin_pages(struct device *dev, unsigned long *user_pfn, int npage,
        if (!group)
                return -ENODEV;
 
-       if (group->dev_counter > 1)
-               return -EINVAL;
+       if (group->dev_counter > 1) {
+               ret = -EINVAL;
+               goto err_pin_pages;
+       }
 
        ret = vfio_group_add_container_user(group);
        if (ret)