Skip to contentSkip to conversation

Xen panic in msi_msg_read_remap_rte with acpi=off

PATCH New Miroslav Rezanina 1 participant 1 message Oct 15, 2009 1 message not in the archive

lore
Share & tools
lore
#1 lore raw

PATCH 1/1 Xen panic in msi_msg_read_remap_rte with acpi=off

In reply to a message not in the archive

Xen kernel panics when "acpi=off noacpi" is set. Problem is caused by dereferncing NULL pointer in drhd after calling acpi_find_matched_drhd_unit. As acpi_find_matched_drhd_unit can return NULL, checks has to be done before returned value is used.

Patch:
----

xen/drivers/passthrough/vtd/intremap.c +4 -0
diff -r 97684ba1303e xen/drivers/passthrough/vtd/intremap.c
@@ -461,6 +461,8 @@
     struct ir_ctrl *ir_ctrl;
 
     drhd = acpi_find_matched_drhd_unit(pdev);
+    if (!drhd)
+	return;
     iommu = drhd->iommu;
 
     ir_ctrl = iommu_ir_ctrl(iommu);
@@ -479,6 +481,8 @@
     struct ir_ctrl *ir_ctrl;
 
     drhd = acpi_find_matched_drhd_unit(pdev);
+    if (!drhd)
+	return;
     iommu = drhd->iommu;
 
     ir_ctrl = iommu_ir_ctrl(iommu);
xen/drivers/passthrough/vtd/iommu.c +3 -1
diff -r 97684ba1303e xen/drivers/passthrough/vtd/iommu.c
@@ -1412,6 +1412,8 @@
         return -ENODEV;
 
     drhd = acpi_find_matched_drhd_unit(pdev);
+    if (!drhd)
+	return -ENODEV;
     pdev_iommu = drhd->iommu;
     domain_context_unmap(source, bus, devfn);
 
@@ -1425,7 +1427,7 @@
     for_each_pdev ( source, pdev )
     {
         drhd = acpi_find_matched_drhd_unit(pdev);
-        if ( drhd->iommu == pdev_iommu )
+        if ( drhd && drhd->iommu == pdev_iommu )
         {
             found = 1;
             break;

----
Miroslav Rezanina
Software Engineer - Virtualization Team - XEN kernel