From: Huaitong Han <huaitong.han@intel.com>
To: tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com
Cc: x86@kernel.org, linux-kernel@vger.kernel.org,
Huaitong Han <huaitong.han@intel.com>
Subject: [PATCH] x86/x2apic: fix x2apic_cluster_probe null pointer
Date: Fri, 12 Aug 2016 13:30:56 +0800 [thread overview]
Message-ID: <1470979856-12290-1-git-send-email-huaitong.han@intel.com> (raw)
percpu cpus_in_cluster is a pointer with CONFIG_CPUMASK_OFFSTACK, cpu_in_cluster
is not alloced memory before x2apic_prepare_cpu is invoked, so cpumask_set_cpu
would get a NULL pointer bug:
BUG: unable to handle kernel NULL pointer dereference at (null)
IP: [<ffffffff8105ac25>] x2apic_cluster_probe+0x35/0x70
Signed-off-by: Huaitong Han <huaitong.han@intel.com>
---
arch/x86/kernel/apic/x2apic_cluster.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/x86/kernel/apic/x2apic_cluster.c b/arch/x86/kernel/apic/x2apic_cluster.c
index 6368fa6..6acb055 100644
--- a/arch/x86/kernel/apic/x2apic_cluster.c
+++ b/arch/x86/kernel/apic/x2apic_cluster.c
@@ -190,9 +190,10 @@ static int x2apic_cluster_probe(void)
if (!x2apic_mode)
return 0;
- cpumask_set_cpu(cpu, per_cpu(cpus_in_cluster, cpu));
cpuhp_setup_state(CPUHP_X2APIC_PREPARE, "X2APIC_PREPARE",
x2apic_prepare_cpu, x2apic_dead_cpu);
+ cpumask_set_cpu(cpu, per_cpu(cpus_in_cluster, cpu));
+
return 1;
}
--
1.8.3.1
next reply other threads:[~2016-08-12 5:31 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-12 5:30 Huaitong Han [this message]
2016-08-12 5:50 ` Wanpeng Li
2016-08-12 5:59 ` Han, Huaitong
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=1470979856-12290-1-git-send-email-huaitong.han@intel.com \
--to=huaitong.han@intel.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.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
all inboxes | Powered by JetHome®