vt-d: Fixpanic in msi_msg_read_remap_rte with acpi=off

Xen panics when "acpi=off noacpi" is set. Problem is caused by
dereferencing 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.

From: Miroslav Rezanina <mrezanin@redhat.com>
Signed-off-by: Keir Fraser <keir.fraser@eu.citrix.com>
This commit is contained in:
Keir Fraser committed 2009-10-16 08:28:47 +01:00
1 parent c5ff46d8d4
commit 4cf3febf20
2 files changed
+7 -4

No files matched your search

+4 -2
View File
@@ -563,7 +563,8 @@ void msi_msg_read_remap_rte(
struct iommu *iommu = NULL;
struct ir_ctrl *ir_ctrl;
drhd = acpi_find_matched_drhd_unit(pdev);
if ( (drhd = acpi_find_matched_drhd_unit(pdev)) == NULL )
return;
iommu = drhd->iommu;
ir_ctrl = iommu_ir_ctrl(iommu);
@@ -581,7 +582,8 @@ void msi_msg_write_remap_rte(
struct iommu *iommu = NULL;
struct ir_ctrl *ir_ctrl;
drhd = acpi_find_matched_drhd_unit(pdev);
if ( (drhd = acpi_find_matched_drhd_unit(pdev)) == NULL )
return;
iommu = drhd->iommu;
ir_ctrl = iommu_ir_ctrl(iommu);
+3 -2
View File
@@ -1343,7 +1343,8 @@ static int reassign_device_ownership(
if (!pdev)
return -ENODEV;
drhd = acpi_find_matched_drhd_unit(pdev);
if ( (drhd = acpi_find_matched_drhd_unit(pdev)) == NULL )
return -ENODEV;
pdev_iommu = drhd->iommu;
domain_context_unmap(source, bus, devfn);
@@ -1357,7 +1358,7 @@ static int reassign_device_ownership(
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;
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.