Commit 696c7f8e authored by Rafael J. Wysocki's avatar Rafael J. Wysocki

ACPI / DMAR: Avoid passing NULL to acpi_put_table()

Linus reported that commit 174cc718 "ACPICA: Tables: Back port
acpi_get_table_with_size() and early_acpi_os_unmap_memory() from
Linux kernel" added a new warning on his desktop system:

 ACPI Warning: Table ffffffff9fe6c0a0, Validation count is zero before decrement

which turns out to come from the acpi_put_table() in
detect_intel_iommu().

This happens if the DMAR table is not present in which case NULL is
passed to acpi_put_table() which doesn't check against that and
attempts to handle it regardless.

For this reason, check the pointer passed to acpi_put_table()
before invoking it.
Reported-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
Tested-by: default avatarPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Fixes: 6b11d1d6 ("ACPI / osl: Remove acpi_get_table_with_size()/early_acpi_os_unmap_memory() users")
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 0c744ea4
...@@ -903,8 +903,10 @@ int __init detect_intel_iommu(void) ...@@ -903,8 +903,10 @@ int __init detect_intel_iommu(void)
x86_init.iommu.iommu_init = intel_iommu_init; x86_init.iommu.iommu_init = intel_iommu_init;
#endif #endif
if (dmar_tbl) {
acpi_put_table(dmar_tbl); acpi_put_table(dmar_tbl);
dmar_tbl = NULL; dmar_tbl = NULL;
}
up_write(&dmar_global_lock); up_write(&dmar_global_lock);
return ret ? 1 : -ENODEV; return ret ? 1 : -ENODEV;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment