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-4.0-testing] VT-d: Fix resource leaks on error path

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-4.0-testing] VT-d: Fix resource leaks on error paths
From: Xen patchbot-4.0-testing <patchbot@xxxxxxx>
Date: Tue, 17 May 2011 15:45:10 +0100
Delivery-date: Tue, 17 May 2011 07:46:27 -0700
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 Igor Mammedov <imammedo@xxxxxxxxxx>
# Date 1305549685 -3600
# Node ID f9355c999a0f6ed7ed82ca4eef64e8350159b22e
# Parent  0e31cda80a7b50ff752719bea1f6578d6bf16a10
VT-d: Fix resource leaks on error paths

On error exit from functions, maped pages should be unmapped
and acquired locks released.

Signed-off-by: Igor Mammedov <imammedo@xxxxxxxxxx>
Acked-by: Allen Kay <allen.m.kay@xxxxxxxxx>
xen-unstable changeset:   23343:edcf8fc77b64
xen-unstable date:        Mon May 16 13:29:24 2011 +0100
---


diff -r 0e31cda80a7b -r f9355c999a0f xen/drivers/passthrough/vtd/intremap.c
--- a/xen/drivers/passthrough/vtd/intremap.c    Mon May 16 13:40:51 2011 +0100
+++ b/xen/drivers/passthrough/vtd/intremap.c    Mon May 16 13:41:25 2011 +0100
@@ -213,7 +213,8 @@
     if ( iremap_entries )
         unmap_vtd_domain_page(iremap_entries);
 
-    ir_ctrl->iremap_num++;
+    if ( i < IREMAP_ENTRY_NR ) 
+        ir_ctrl->iremap_num++;
     return i;
 }
 
@@ -249,6 +250,8 @@
         dprintk(XENLOG_ERR VTDPREFIX,
                 "%s: index (%d) get an empty entry!\n",
                 __func__, index);
+        unmap_vtd_domain_page(iremap_entries);
+        spin_unlock_irqrestore(&ir_ctrl->iremap_lock, flags);
         return -EFAULT;
     }
 
@@ -284,7 +287,8 @@
     if ( index < 0 )
     {
         index = alloc_remap_entry(iommu);
-        apic_pin_2_ir_idx[apic][ioapic_pin] = index;
+        if ( index < IREMAP_ENTRY_NR )
+            apic_pin_2_ir_idx[apic][ioapic_pin] = index;
     }
 
     if ( index > IREMAP_ENTRY_NR - 1 )
@@ -549,6 +553,8 @@
         dprintk(XENLOG_ERR VTDPREFIX,
                 "%s: index (%d) get an empty entry!\n",
                 __func__, index);
+        unmap_vtd_domain_page(iremap_entries);
+        spin_unlock_irqrestore(&ir_ctrl->iremap_lock, flags);
         return -EFAULT;
     }
 

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-4.0-testing] VT-d: Fix resource leaks on error paths, Xen patchbot-4 . 0-testing <=