[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] add NULL checks in code added by 24492:6c104b46ef89



# HG changeset patch
# User Jan Beulich <jbeulich@xxxxxxxx>
# Date 1326964092 -3600
# Node ID 9a967990b4d2ce4a740662c2ad6b1e5d2adec984
# Parent  15ab61865ecbd146f6ce65fbea5bf49bfd9c6cb1
add NULL checks in code added by 24492:6c104b46ef89

Also a couple of missing is_hvm_domain() checks.

Further properly pass the PCI segment in a call to pci_get_pdev().

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
---


diff -r 15ab61865ecb -r 9a967990b4d2 xen/drivers/passthrough/amd/iommu_guest.c
--- a/xen/drivers/passthrough/amd/iommu_guest.c Tue Jan 17 12:40:52 2012 +0000
+++ b/xen/drivers/passthrough/amd/iommu_guest.c Thu Jan 19 10:08:12 2012 +0100
@@ -182,7 +182,13 @@
     ppr_entry_t *log, *log_base;
     struct guest_iommu *iommu;
 
+    if ( !is_hvm_domain(d) )
+        return;
+
     iommu = domain_iommu(d);
+    if ( !iommu )
+        return;
+
     tail = iommu_get_rb_pointer(iommu->ppr_log.reg_tail.lo);
     head = iommu_get_rb_pointer(iommu->ppr_log.reg_head.lo);
 
@@ -225,7 +231,13 @@
     event_entry_t *log, *log_base;
     struct guest_iommu *iommu;
 
+    if ( !is_hvm_domain(d) )
+        return;
+
     iommu = domain_iommu(d);
+    if ( !iommu )
+        return;
+
     tail = iommu_get_rb_pointer(iommu->event_log.reg_tail.lo);
     head = iommu_get_rb_pointer(iommu->event_log.reg_head.lo);
 
@@ -793,6 +805,9 @@
     p2m_type_t t;
     struct guest_iommu *iommu = domain_iommu(d);
 
+    if ( !iommu )
+        return -EACCES;
+
     iommu->mmio_base = base;
     base >>= PAGE_SHIFT;
 
@@ -882,6 +897,8 @@
         return;
 
     iommu = domain_iommu(d);
+    if ( !iommu )
+        return;
 
     tasklet_kill(&iommu->cmd_buffer_tasklet);
     xfree(iommu);
@@ -893,7 +910,7 @@
 {
     struct guest_iommu *iommu = vcpu_iommu(v);
 
-    return addr >= iommu->mmio_base &&
+    return iommu && addr >= iommu->mmio_base &&
            addr < iommu->mmio_base + IOMMU_MMIO_SIZE;
 }
 
diff -r 15ab61865ecb -r 9a967990b4d2 xen/drivers/passthrough/amd/iommu_init.c
--- a/xen/drivers/passthrough/amd/iommu_init.c  Tue Jan 17 12:40:52 2012 +0000
+++ b/xen/drivers/passthrough/amd/iommu_init.c  Thu Jan 19 10:08:12 2012 +0100
@@ -651,7 +651,7 @@
     local_irq_enable();
 
     spin_lock(&pcidevs_lock);
-    pdev = pci_get_pdev(0, bus, devfn);
+    pdev = pci_get_pdev(iommu->seg, bus, devfn);
     spin_unlock(&pcidevs_lock);
 
     local_irq_disable();

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.