linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: tip-bot for Rui Wang <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, rui.y.wang@intel.com,
	tglx@linutronix.de, mingo@kernel.org, hpa@zytor.com
Subject: [tip:x86/apic] x86/ioapic: Fix incorrect pointers in ioapic_setup_resources()
Date: Fri, 10 Jun 2016 05:01:41 -0700	[thread overview]
Message-ID: <tip-3d98217b6726e0c342ac6363346bd9751fd61ec9@git.kernel.org> (raw)
In-Reply-To: <1465369193-4816-3-git-send-email-rui.y.wang@intel.com>

Commit-ID:  3d98217b6726e0c342ac6363346bd9751fd61ec9
Gitweb:     http://git.kernel.org/tip/3d98217b6726e0c342ac6363346bd9751fd61ec9
Author:     Rui Wang <rui.y.wang@intel.com>
AuthorDate: Wed, 8 Jun 2016 14:59:52 +0800
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Fri, 10 Jun 2016 13:55:03 +0200

x86/ioapic: Fix incorrect pointers in ioapic_setup_resources()

On a 4-socket Brickland system, hot-removing one ioapic is fine.
Hot-removing the 2nd one causes panic in mp_unregister_ioapic()
while calling release_resource().

It is because the iomem_res pointer has already been released
when removing the first ioapic.

To explain the use of &res[num] here: res is assigned to ioapic_resources,
and later in ioapic_insert_resources() we do:

	struct resource *r = ioapic_resources;

        for_each_ioapic(i) {
                insert_resource(&iomem_resource, r);
                r++;
        }

Here 'r' is treated as an arry of 'struct resource', and the r++ ensures
that each element of the array is inserted separately. Thus we should call
release_resouce() on each element at &res[num].

Fix it by assigning the correct pointers to ioapics[i].iomem_res in
ioapic_setup_resources().

Signed-off-by: Rui Wang <rui.y.wang@intel.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: tony.luck@intel.com
Cc: linux-pci@vger.kernel.org
Cc: rjw@rjwysocki.net
Cc: linux-acpi@vger.kernel.org
Cc: bhelgaas@google.com
Link: http://lkml.kernel.org/r/1465369193-4816-3-git-send-email-rui.y.wang@intel.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>

Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/kernel/apic/io_apic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index 84e33ff..446702e 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -2588,8 +2588,8 @@ static struct resource * __init ioapic_setup_resources(void)
 		res[num].flags = IORESOURCE_MEM | IORESOURCE_BUSY;
 		snprintf(mem, IOAPIC_RESOURCE_NAME_SIZE, "IOAPIC %u", i);
 		mem += IOAPIC_RESOURCE_NAME_SIZE;
+		ioapics[i].iomem_res = &res[num];
 		num++;
-		ioapics[i].iomem_res = res;
 	}
 
 	ioapic_resources = res;

  parent reply	other threads:[~2016-06-10 12:02 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-08  6:59 [PATCH V2 0/3] ioapic hot-removal bugs Rui Wang
2016-06-08  6:59 ` [PATCH V2 1/3] x86/ioapic: Support hot-removal of IOAPICs present during boot Rui Wang
2016-06-08  8:05   ` kbuild test robot
2016-06-08  9:32   ` [PATCH V3 " Rui Wang
2016-06-10 12:57     ` Thomas Gleixner
2016-06-10 13:56       ` Rafael J. Wysocki
2016-06-10 16:43     ` Bjorn Helgaas
2016-06-12  6:06       ` Rui Wang
2016-06-16 17:09         ` Bjorn Helgaas
2016-06-22  7:13           ` Rui Wang
2016-06-22 14:53             ` Bjorn Helgaas
2016-06-24 15:18               ` Rui Wang
2016-06-22  7:40           ` [PATCH V4 " Rui Wang
2016-06-22 15:14             ` Bjorn Helgaas
2016-06-23  5:11               ` 
2016-06-23 17:34                 ` Bjorn Helgaas
2016-06-24 15:30                   ` Rui Wang
2016-06-26  3:44                   ` [PATCH V5 " Rui Wang
2016-08-08 20:22                     ` Bjorn Helgaas
2016-08-09  3:23                       ` Rui Wang
2016-08-09 12:09                         ` Rafael J. Wysocki
2016-06-08  6:59 ` [PATCH V2 2/3] x86/ioapic: Fix wrong pointers in ioapic_setup_resources() Rui Wang
2016-06-10  9:45   ` [tip:x86/urgent] " tip-bot for Rui Wang
2016-06-10 12:01   ` tip-bot for Rui Wang [this message]
2016-06-10 12:48   ` [tip:x86/urgent] x86/ioapic: Fix incorrect " tip-bot for Rui Wang
2016-06-08  6:59 ` [PATCH V2 3/3] x86/ioapic: Simplify ioapic_setup_resources() Rui Wang
2016-06-10  9:48   ` [tip:x86/apic] " tip-bot for Rui Wang
2016-06-10 12:54   ` tip-bot for Rui Wang

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=tip-3d98217b6726e0c342ac6363346bd9751fd61ec9@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=rui.y.wang@intel.com \
    --cc=tglx@linutronix.de \
    /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).