lkml.org 
[lkml]   [2016]   [Aug]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] x86/x2apic: fix x2apic_cluster_probe null pointer
Date
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
\
 
 \ /
  Last update: 2016-09-17 09:56    [W:0.035 / U:0.128 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site