Skip to contentSkip to conversation

vfio: fix a missed vfio group put in vfio_pin_pages

PATCH Superseded Yan Zhao 2 participants 3 messages Sep 15, 2020 – Sep 16, 2020

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Yan Zhao

author
#0 lore raw

PATCH 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)

---
 drivers/vfio/vfio.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/vfio/vfio.c +4 -2
index 262ab0efd06c..5e6e0511b5aa 100644
@@ -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
Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · On Tue, 15 Sep 2020 08:28:35 +0800 Yan Zhao <[email protected]> wrote:

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)

The format of the Fixes: line should be

Fixes 95fc87b44104 ("vfio: Selective dirty page tracking if IOMMU backed device pins pages")
Quoted 5 lines
---
 drivers/vfio/vfio.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
author
#2 lore raw
Quoted 12 lines · Cornelia Huck
Quoted 4 lines · On Tue, 15 Sep 2020 08:28:35 +0800 Yan Zhao <[email protected]> wrote:

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)

The format of the Fixes: line should be

Fixes 95fc87b44104 ("vfio: Selective dirty page tracking if IOMMU backed device pins pages")

got it. thanks! I'll update it.

Thanks
Yan

Quoted 8 lines
Quoted 5 lines
---
 drivers/vfio/vfio.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)