Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1551528

[PATCH] ACPI / DMAR: Avoid passing NULL to acpi_put_table()

From "Rafael J. Wysocki" <rjw@rjwysocki.net>
Newsgroups linux.kernel
Subject [PATCH] ACPI / DMAR: Avoid passing NULL to acpi_put_table()
Date 2017-01-05 01:30 +0100
Message-ID <sW46m-3Fd-15@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Linus reported that commit 174cc7187e6f "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: Linus Torvalds <torvalds@linux-foundation.org> 
Fixes: 6b11d1d67713 ("ACPI / osl: Remove acpi_get_table_with_size()/early_acpi_os_unmap_memory() users")
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/iommu/dmar.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Index: linux-pm/drivers/iommu/dmar.c
===================================================================
--- linux-pm.orig/drivers/iommu/dmar.c
+++ linux-pm/drivers/iommu/dmar.c
@@ -903,8 +903,10 @@ int __init detect_intel_iommu(void)
 		x86_init.iommu.iommu_init = intel_iommu_init;
 #endif
 
-	acpi_put_table(dmar_tbl);
-	dmar_tbl = NULL;
+	if (dmar_tbl) {
+		acpi_put_table(dmar_tbl);
+		dmar_tbl = NULL;
+	}
 	up_write(&dmar_global_lock);
 
 	return ret ? 1 : -ENODEV;

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] ACPI / DMAR: Avoid passing NULL to acpi_put_table() "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2017-01-05 01:30 +0100
  Re: [PATCH] ACPI / DMAR: Avoid passing NULL to acpi_put_table() "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-01-05 07:30 +0100
  Re: [PATCH] ACPI / DMAR: Avoid passing NULL to acpi_put_table() Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-01-05 18:50 +0100
  RE: [PATCH] ACPI / DMAR: Avoid passing NULL to acpi_put_table() "Zheng, Lv" <lv.zheng@intel.com> - 2017-01-06 03:00 +0100

csiph-web