All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/x2apic: fix x2apic_cluster_probe null pointer
@ 2016-08-12  5:30 Huaitong Han
  2016-08-12  5:50 ` Wanpeng Li
  0 siblings, 1 reply; 3+ messages in thread
From: Huaitong Han @ 2016-08-12  5:30 UTC (permalink / raw)
  To: tglx, mingo, hpa; +Cc: x86, linux-kernel, Huaitong Han

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] x86/x2apic: fix x2apic_cluster_probe null pointer
  2016-08-12  5:30 [PATCH] x86/x2apic: fix x2apic_cluster_probe null pointer Huaitong Han
@ 2016-08-12  5:50 ` Wanpeng Li
  2016-08-12  5:59   ` Han, Huaitong
  0 siblings, 1 reply; 3+ messages in thread
From: Wanpeng Li @ 2016-08-12  5:50 UTC (permalink / raw)
  To: Huaitong Han
  Cc: Thomas Gleixner, Ingo Molnar, H. Peter Anvin,
	the arch/x86 maintainers, linux-kernel

2016-08-12 13:30 GMT+08:00 Huaitong Han <huaitong.han@intel.com>:
> 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

Could you try this? https://lkml.org/lkml/2016/8/4/345

Regards,
Wanpeng Li

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] x86/x2apic: fix x2apic_cluster_probe null pointer
  2016-08-12  5:50 ` Wanpeng Li
@ 2016-08-12  5:59   ` Han, Huaitong
  0 siblings, 0 replies; 3+ messages in thread
From: Han, Huaitong @ 2016-08-12  5:59 UTC (permalink / raw)
  To: kernellwp; +Cc: tglx, hpa, linux-kernel, mingo, x86

On Fri, 2016-08-12 at 13:50 +0800, Wanpeng Li wrote:
> 2016-08-12 13:30 GMT+08:00 Huaitong Han <huaitong.han@intel.com>:
> > 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
> 
> Could you try this? https://lkml.org/lkml/2016/8/4/345
Get, it has been fixed,
http://git.kernel.org/cgit/linux/kernel/git/tip/tip.git/commit/?id=d52c0569bab4edc888832df44dc7ac28517134f6
> 
> Regards,
> Wanpeng Li

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-08-12  6:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-12  5:30 [PATCH] x86/x2apic: fix x2apic_cluster_probe null pointer Huaitong Han
2016-08-12  5:50 ` Wanpeng Li
2016-08-12  5:59   ` Han, Huaitong

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.