diff mbox series

vfio: fix a missed vfio group put in vfio_pin_pages

Message ID 20200915002835.14213-1-yan.y.zhao@intel.com (mailing list archive)
State New, archived
Headers show
Series vfio: fix a missed vfio group put in vfio_pin_pages | expand

Commit Message

Yan Zhao Sept. 15, 2020, 12:28 a.m. UTC
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>
---
 drivers/vfio/vfio.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Cornelia Huck Sept. 15, 2020, 9:06 a.m. UTC | #1
On Tue, 15 Sep 2020 08:28:35 +0800
Yan Zhao <yan.y.zhao@intel.com> 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")

> 
> Signed-off-by: Yan Zhao <yan.y.zhao@intel.com>
> ---
>  drivers/vfio/vfio.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)

Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Yan Zhao Sept. 16, 2020, 1:33 a.m. UTC | #2
On Tue, Sep 15, 2020 at 11:06:01AM +0200, Cornelia Huck wrote:
> On Tue, 15 Sep 2020 08:28:35 +0800
> Yan Zhao <yan.y.zhao@intel.com> 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
> > 
> > Signed-off-by: Yan Zhao <yan.y.zhao@intel.com>
> > ---
> >  drivers/vfio/vfio.c | 6 ++++--
> >  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> Reviewed-by: Cornelia Huck <cohuck@redhat.com>
>
diff mbox series

Patch

diff --git a/drivers/vfio/vfio.c b/drivers/vfio/vfio.c
index 262ab0efd06c..5e6e0511b5aa 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)