vfio: fix a missed vfio group put in vfio_pin_pages
Subsystems (2)
PATCH v2 1/1 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")
Reviewed-by Cornelia Huck <[email protected]>
Signed-off-by Yan Zhao <[email protected]>
---
v2: updated the format of the Fixes: line. (Cornelia)
--- drivers/vfio/vfio.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/vfio/vfio.c +4 -2
@@ -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)
Signature · 1 line
2.17.1