[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1AE640813FDE7649BE1B193DEA596E886CE21D2D@SHSMSX101.ccr.corp.intel.com>
Date: Fri, 6 Jan 2017 01:49:26 +0000
From: "Zheng, Lv" <lv.zheng@...el.com>
To: "Rafael J. Wysocki" <rjw@...ysocki.net>,
Linux ACPI <linux-acpi@...r.kernel.org>
CC: LKML <linux-kernel@...r.kernel.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
"Moore, Robert" <robert.moore@...el.com>,
"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>,
"iommu@...ts.linux-foundation.org" <iommu@...ts.linux-foundation.org>
Subject: RE: [PATCH] ACPI / DMAR: Avoid passing NULL to acpi_put_table()
Hi, Rafael
> From: linux-acpi-owner@...r.kernel.org [mailto:linux-acpi-owner@...r.kernel.org] On Behalf Of Rafael J.
> Wysocki
> Subject: [PATCH] ACPI / DMAR: Avoid passing NULL to acpi_put_table()
>
> From: Rafael J. Wysocki <rafael.j.wysocki@...el.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@...ux-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@...el.com>
Thanks for looking into this issue.
The patch fixes the caller side and thus looks very good from my opinion.
Acked-by: Lv Zheng <lv.zheng@...el.com>
Best regards
Lv
> ---
> 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;
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists