Skip to content

Commit

Permalink
iommu/vt-d: Check for NULL pointer in dmar_acpi_dev_scope_init()
Browse files Browse the repository at this point in the history
When ir_dev_scope_init() is called via a rootfs initcall it
will check for irq_remapping_enabled before it calls
(indirectly) into dmar_acpi_dev_scope_init() which uses the
dmar_tbl pointer without any checks.

The AMD IOMMU driver also sets the irq_remapping_enabled
flag which causes the dmar_acpi_dev_scope_init() function to
be called on systems with AMD IOMMU hardware too, causing a
boot-time kernel crash.

Signed-off-by: Joerg Roedel <joro@8bytes.org>
  • Loading branch information
Joerg Roedel committed Mar 25, 2014
1 parent cf04eee commit 11f1a77
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion drivers/iommu/dmar.c
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,12 @@ static void __init dmar_acpi_insert_dev_scope(u8 device_number,

static int __init dmar_acpi_dev_scope_init(void)
{
struct acpi_dmar_andd *andd = (void *)dmar_tbl + sizeof(struct acpi_table_dmar);
struct acpi_dmar_andd *andd;

if (dmar_tbl == NULL)
return -ENODEV;

andd = (void *)dmar_tbl + sizeof(struct acpi_table_dmar);

while (((unsigned long)andd) <
((unsigned long)dmar_tbl) + dmar_tbl->length) {
Expand Down

0 comments on commit 11f1a77

Please sign in to comment.