All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] vfio: fix a missed vfio group put in vfio_pin_pages
@ 2020-09-15  0:28 Yan Zhao
  2020-09-15  9:06 ` Cornelia Huck
  0 siblings, 1 reply; 3+ messages in thread
From: Yan Zhao @ 2020-09-15  0:28 UTC (permalink / raw)
  To: alex.williamson, cohuck; +Cc: kvm, linux-kernel, Yan Zhao

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

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] vfio: fix a missed vfio group put in vfio_pin_pages
  2020-09-15  0:28 [PATCH] vfio: fix a missed vfio group put in vfio_pin_pages Yan Zhao
@ 2020-09-15  9:06 ` Cornelia Huck
  2020-09-16  1:33   ` Yan Zhao
  0 siblings, 1 reply; 3+ messages in thread
From: Cornelia Huck @ 2020-09-15  9:06 UTC (permalink / raw)
  To: Yan Zhao; +Cc: alex.williamson, kvm, linux-kernel

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>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] vfio: fix a missed vfio group put in vfio_pin_pages
  2020-09-15  9:06 ` Cornelia Huck
@ 2020-09-16  1:33   ` Yan Zhao
  0 siblings, 0 replies; 3+ messages in thread
From: Yan Zhao @ 2020-09-16  1:33 UTC (permalink / raw)
  To: Cornelia Huck; +Cc: alex.williamson, kvm, linux-kernel

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-09-16  1:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-15  0:28 [PATCH] vfio: fix a missed vfio group put in vfio_pin_pages Yan Zhao
2020-09-15  9:06 ` Cornelia Huck
2020-09-16  1:33   ` Yan Zhao

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.