summaryrefslogtreecommitdiff
path: root/drivers/vfio
diff options
context:
space:
mode:
authorYan Zhao <yan.y.zhao@intel.com>2020-09-16 05:29:27 +0300
committerAlex Williamson <alex.williamson@redhat.com>2020-09-22 19:56:40 +0300
commit28b130244061863cf0437b7af1625fb45ec1a71e (patch)
tree10182f8e9dde0cbf6cde13480db6bbf85d766fa2 /drivers/vfio
parent7ef32e52368f62a4e041a4f0abefb4fb64e7fd4a (diff)
downloadlinux-28b130244061863cf0437b7af1625fb45ec1a71e.tar.xz
vfio: fix a missed vfio group put in vfio_pin_pages
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>
Diffstat (limited to 'drivers/vfio')
-rw-r--r--drivers/vfio/vfio.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/vfio/vfio.c b/drivers/vfio/vfio.c
index 532bcaf28c11..2151bc7f87ab 100644
--- a/drivers/vfio/vfio.c
+++ b/drivers/vfio/vfio.c
@@ -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)