Commit 28b13024 authored by Yan Zhao's avatar Yan Zhao Committed by Alex Williamson

vfio: fix a missed vfio group put in vfio_pin_pages

When error occurs, need to put vfio group after a successful get.

Fixes: 95fc87b4 ("vfio: Selective dirty page tracking if IOMMU backed device pins pages")
Signed-off-by: default avatarYan Zhao <yan.y.zhao@intel.com>
Reviewed-by: default avatarCornelia Huck <cohuck@redhat.com>
Signed-off-by: default avatarAlex Williamson <alex.williamson@redhat.com>
parent 7ef32e52
...@@ -1949,8 +1949,10 @@ int vfio_pin_pages(struct device *dev, unsigned long *user_pfn, int npage, ...@@ -1949,8 +1949,10 @@ int vfio_pin_pages(struct device *dev, unsigned long *user_pfn, int npage,
if (!group) if (!group)
return -ENODEV; return -ENODEV;
if (group->dev_counter > 1) if (group->dev_counter > 1) {
return -EINVAL; ret = -EINVAL;
goto err_pin_pages;
}
ret = vfio_group_add_container_user(group); ret = vfio_group_add_container_user(group);
if (ret) if (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