WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] VT-d: fix iommu_domain_destroy

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] VT-d: fix iommu_domain_destroy
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Mon, 04 Jan 2010 01:15:15 -0800
Delivery-date: Mon, 04 Jan 2010 01:15:35 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1262595996 0
# Node ID bf43d35585fb283f33df02ec9bfd4887de24cf11
# Parent  b76fe58d07018a12f934aacb43a3e880323a2ede
VT-d: fix iommu_domain_destroy

Currently, g2m_ioport list and mapped_rmrrs always won't be released
in iommu_domain_destroy, because the function returns before those
code. It causes potential leak. This patch releases them, and thus
avoid the potential leak.

Signed-off-by: Weidong Han <Weidong.han@xxxxxxxxx>
---
 xen/drivers/passthrough/iommu.c |   39 +++++++++++++++------------------------
 1 files changed, 15 insertions(+), 24 deletions(-)

diff -r b76fe58d0701 -r bf43d35585fb xen/drivers/passthrough/iommu.c
--- a/xen/drivers/passthrough/iommu.c   Mon Jan 04 09:06:02 2010 +0000
+++ b/xen/drivers/passthrough/iommu.c   Mon Jan 04 09:06:36 2010 +0000
@@ -195,34 +195,25 @@ void iommu_domain_destroy(struct domain 
     if ( !iommu_enabled || !hd->platform_ops )
         return;
 
-    if ( !need_iommu(d)  )
-        return;
-
     if ( need_iommu(d) )
     {
         d->need_iommu = 0;
         hd->platform_ops->teardown(d);
-        return;
-    }
-
-    if ( hd )
-    {
-        list_for_each_safe ( ioport_list, tmp, &hd->g2m_ioport_list )
-        {
-            ioport = list_entry(ioport_list, struct g2m_ioport, list);
-            list_del(&ioport->list);
-            xfree(ioport);
-        }
-
-        list_for_each_safe ( rmrr_list, tmp, &hd->mapped_rmrrs )
-        {
-            mrmrr = list_entry(rmrr_list, struct mapped_rmrr, list);
-            list_del(&mrmrr->list);
-            xfree(mrmrr);
-        }
-    }
-
-    return hd->platform_ops->teardown(d);
+    }
+
+    list_for_each_safe ( ioport_list, tmp, &hd->g2m_ioport_list )
+    {
+        ioport = list_entry(ioport_list, struct g2m_ioport, list);
+        list_del(&ioport->list);
+        xfree(ioport);
+    }
+
+    list_for_each_safe ( rmrr_list, tmp, &hd->mapped_rmrrs )
+    {
+        mrmrr = list_entry(rmrr_list, struct mapped_rmrr, list);
+        list_del(&mrmrr->list);
+        xfree(mrmrr);
+    }
 }
 
 int iommu_map_page(struct domain *d, unsigned long gfn, unsigned long mfn)

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] VT-d: fix iommu_domain_destroy, Xen patchbot-unstable <=