]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob
60834461571dbfd7ec313565c1ce05fc4e20b393
[thirdparty/kernel/stable-queue.git] /
1 From a7c734140aa36413944eef0f8c660e0e2256357d Mon Sep 17 00:00:00 2001
2 From: Thomas Gleixner <tglx@linutronix.de>
3 Date: Tue, 12 Jul 2016 21:59:23 +0200
4 Subject: cpu/hotplug: Keep enough storage space if SMP=n to avoid array out of bounds scribble
5
6 From: Thomas Gleixner <tglx@linutronix.de>
7
8 commit a7c734140aa36413944eef0f8c660e0e2256357d upstream.
9
10 Xiaolong Ye reported lock debug warnings triggered by the following commit:
11
12 8de4a0066106 ("perf/x86: Convert the core to the hotplug state machine")
13
14 The bug is the following: the cpuhp_bp_states[] array is cut short when
15 CONFIG_SMP=n, but the dynamically registered callbacks are stored nevertheless
16 and happily scribble outside of the array bounds...
17
18 We need to store them in case that the state is unregistered so we can invoke
19 the teardown function. That's independent of CONFIG_SMP. Make sure the array
20 is large enough.
21
22 Reported-by: kernel test robot <xiaolong.ye@intel.com>
23 Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
24 Cc: Adam Borowski <kilobyte@angband.pl>
25 Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
26 Cc: Anna-Maria Gleixner <anna-maria@linutronix.de>
27 Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
28 Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
29 Cc: Borislav Petkov <bp@suse.de>
30 Cc: Jiri Olsa <jolsa@redhat.com>
31 Cc: Kan Liang <kan.liang@intel.com>
32 Cc: Linus Torvalds <torvalds@linux-foundation.org>
33 Cc: Peter Zijlstra <peterz@infradead.org>
34 Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
35 Cc: Stephane Eranian <eranian@google.com>
36 Cc: Vince Weaver <vincent.weaver@maine.edu>
37 Cc: lkp@01.org
38 Cc: tipbuild@zytor.com
39 Fixes: cff7d378d3fd "cpu/hotplug: Convert to a state machine for the control processor"
40 Link: http://lkml.kernel.org/r/alpine.DEB.2.11.1607122144560.4083@nanos
41 Signed-off-by: Ingo Molnar <mingo@kernel.org>
42 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
43
44 ---
45 kernel/cpu.c | 2 ++
46 1 file changed, 2 insertions(+)
47
48 --- a/kernel/cpu.c
49 +++ b/kernel/cpu.c
50 @@ -1218,6 +1218,8 @@ static struct cpuhp_step cpuhp_bp_states
51 .teardown = takedown_cpu,
52 .cant_stop = true,
53 },
54 +#else
55 + [CPUHP_BRINGUP_CPU] = { },
56 #endif
57 };
58