linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joerg Roedel <joro@8bytes.org>
To: "Rafael J. Wysocki" <rjw@rjwysocki.net>, Len Brown <lenb@kernel.org>
Cc: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org,
	Joerg Roedel <jroedel@suse.de>
Subject: [PATCH 1/3] ACPI, ioapic: Clear on-stack resource before using it
Date: Wed, 22 Mar 2017 18:33:23 +0100	[thread overview]
Message-ID: <1490204005-2733-2-git-send-email-joro@8bytes.org> (raw)
In-Reply-To: <1490204005-2733-1-git-send-email-joro@8bytes.org>

From: Joerg Roedel <jroedel@suse.de>

The on-stack resource-window 'win' in setup_res() is not
properly initialized. This causes the pointers in the
embedded 'struct resource' to contain stale pointers.

These pointers (in my case the ->child pointer) gets later
propagated to the global iomem_resources list, causing a #GP
exception when the list is traversed in
iomem_map_sanity_check().

Fixes: c183619b63ec ('x86/irq, ACPI: Implement ACPI driver to support IOAPIC hotplug')
Signed-off-by: Joerg Roedel <jroedel@suse.de>
---
 drivers/acpi/ioapic.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/acpi/ioapic.c b/drivers/acpi/ioapic.c
index 1120dfd6..7e4fbf9 100644
--- a/drivers/acpi/ioapic.c
+++ b/drivers/acpi/ioapic.c
@@ -45,6 +45,12 @@ static acpi_status setup_res(struct acpi_resource *acpi_res, void *data)
 	struct resource *res = data;
 	struct resource_win win;
 
+	/*
+	 * We might assign this to 'res' later, make sure all pointers are
+	 * cleared before the resource is added to the global list
+	 */
+	memset(&win, 0, sizeof(win));
+
 	res->flags = 0;
 	if (acpi_dev_filter_resource_type(acpi_res, IORESOURCE_MEM))
 		return AE_OK;
-- 
1.9.1


  reply	other threads:[~2017-03-22 17:33 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-22 17:33 [PATCH 0/3] ACPI Fixes for Hotplug Joerg Roedel
2017-03-22 17:33 ` Joerg Roedel [this message]
2017-03-22 17:33 ` [PATCH 2/3] ACPI: Remove platform devices from a bus on removal Joerg Roedel
2017-04-19  6:50   ` joeyli
2017-04-19  6:54     ` joeyli
2017-03-22 17:33 ` [PATCH 3/3] ACPI: Don't create a platform_device for IOAPIC/IOxAPIC Joerg Roedel
2017-03-22 17:42   ` Rafael J. Wysocki
2017-03-22 22:58     ` Joerg Roedel
2017-03-22 23:41       ` Rafael J. Wysocki
2017-03-22 23:44         ` Rafael J. Wysocki
2017-03-22 23:58           ` Joerg Roedel
2017-03-23  1:06             ` Rafael J. Wysocki
2017-03-23 10:50               ` Joerg Roedel
2017-03-23 11:19                 ` Rafael J. Wysocki

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=1490204005-2733-2-git-send-email-joro@8bytes.org \
    --to=joro@8bytes.org \
    --cc=jroedel@suse.de \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    /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;
as well as URLs for NNTP newsgroup(s).