mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
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:
1 parent
c5ff46d8d4
commit
4cf3febf20
2 files changed
+7
-4
No files matched your search
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||