From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Linux ACPI <linux-acpi@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
Lv Zheng <lv.zheng@intel.com>,
Robert Moore <robert.moore@intel.com>,
iommu@lists.linux-foundation.org
Subject: Re: [PATCH] ACPI / DMAR: Avoid passing NULL to acpi_put_table()
Date: Wed, 4 Jan 2017 22:19:57 -0800 [thread overview]
Message-ID: <20170105061957.GB3742@linux.vnet.ibm.com> (raw)
In-Reply-To: <3112193.PjflRgTHFW@aspire.rjw.lan>
On Thu, Jan 05, 2017 at 01:24:14AM +0100, Rafael J. Wysocki wrote:
> 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>
Much better!
Tested-by: Paul E. McKenney <paulmck@linux.vnet.ibm.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;
>
next prev parent reply other threads:[~2017-01-05 6:19 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-05 0:24 [PATCH] ACPI / DMAR: Avoid passing NULL to acpi_put_table() Rafael J. Wysocki
2017-01-05 6:19 ` Paul E. McKenney [this message]
[not found] ` <3112193.PjflRgTHFW-yvgW3jdyMHm1GS7QM15AGw@public.gmane.org>
2017-01-05 17:41 ` Andy Shevchenko
2017-01-06 1:49 ` Zheng, Lv
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170105061957.GB3742@linux.vnet.ibm.com \
--to=paulmck@linux.vnet.ibm.com \
--cc=iommu@lists.linux-foundation.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lv.zheng@intel.com \
--cc=rjw@rjwysocki.net \
--cc=robert.moore@intel.com \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox