# HG changeset patch
# User Igor Mammedov <imammedo@xxxxxxxxxx>
# Date 1305549489 -3600
# Node ID 32ce58b3a9f977a39481d546c9781faea8ecd075
# Parent 58a1942959bf56ffdc62d2eb7f81b9eb4793837e
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 58a1942959bf -r 32ce58b3a9f9 xen/drivers/passthrough/vtd/intremap.c
--- a/xen/drivers/passthrough/vtd/intremap.c Mon May 16 13:37:28 2011 +0100
+++ b/xen/drivers/passthrough/vtd/intremap.c Mon May 16 13:38:09 2011 +0100
@@ -210,7 +210,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;
}
@@ -246,6 +247,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;
}
@@ -281,7 +284,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 )
@@ -546,6 +550,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
|