From: Miroslav Rezanina Subject: [PATCH] Xen panic in msi_msg_read_remap_rte with acpi=off Date: Thu, 15 Oct 2009 08:21:21 -0400 (EDT) Message-ID: <1628780213.242021255609281946.JavaMail.root@zmail06.collab.prod.int.phx2.redhat.com> References: <382132407.241921255609267811.JavaMail.root@zmail06.collab.prod.int.phx2.redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <382132407.241921255609267811.JavaMail.root@zmail06.collab.prod.int.phx2.redhat.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel List-Id: xen-devel@lists.xenproject.org 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: ---- diff -r 97684ba1303e xen/drivers/passthrough/vtd/intremap.c --- a/xen/drivers/passthrough/vtd/intremap.c Thu Oct 01 18:39:03 2009 +0100 +++ b/xen/drivers/passthrough/vtd/intremap.c Thu Oct 15 14:08:13 2009 +0200 @@ -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); diff -r 97684ba1303e xen/drivers/passthrough/vtd/iommu.c --- a/xen/drivers/passthrough/vtd/iommu.c Thu Oct 01 18:39:03 2009 +0100 +++ b/xen/drivers/passthrough/vtd/iommu.c Thu Oct 15 14:08:13 2009 +0200 @@ -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