summaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorDietmar Eggemann <dietmar.eggemann@arm.com>2021-02-01 10:53:53 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-03-08 19:07:48 +0100
commit80998dbde14d1717225e76c8258770b8e148c181 (patch)
tree30431b5a08cdc8699cbc7af58d2d2db64e1a4cac /kernel
parent407ec382ba67f63e5432a3f2b112f4e01d54e19a (diff)
downloadlinux-stable-80998dbde14d1717225e76c8258770b8e148c181.tar.gz
linux-stable-80998dbde14d1717225e76c8258770b8e148c181.tar.bz2
linux-stable-80998dbde14d1717225e76c8258770b8e148c181.zip
sched/topology: Fix sched_domain_topology_level alloc in sched_init_numa()
commit 71e5f6644fb2f3304fcb310145ded234a37e7cc1 upstream. Commit "sched/topology: Make sched_init_numa() use a set for the deduplicating sort" allocates 'i + nr_levels (level)' instead of 'i + nr_levels + 1' sched_domain_topology_level. This led to an Oops (on Arm64 juno with CONFIG_SCHED_DEBUG): sched_init_domains build_sched_domains() __free_domain_allocs() __sdt_free() { ... for_each_sd_topology(tl) ... sd = *per_cpu_ptr(sdd->sd, j); <-- ... } Signed-off-by: Dietmar Eggemann <dietmar.eggemann@arm.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Ingo Molnar <mingo@kernel.org> Tested-by: Vincent Guittot <vincent.guittot@linaro.org> Tested-by: Barry Song <song.bao.hua@hisilicon.com> Link: https://lkml.kernel.org/r/6000e39e-7d28-c360-9cd6-8798fd22a9bf@arm.com Signed-off-by: dann frazier <dann.frazier@canonical.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/sched/topology.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c
index f0d0ddf0a8b4..e5ebaffc4fef 100644
--- a/kernel/sched/topology.c
+++ b/kernel/sched/topology.c
@@ -1658,7 +1658,7 @@ void sched_init_numa(void)
/* Compute default topology size */
for (i = 0; sched_domain_topology[i].mask; i++);
- tl = kzalloc((i + nr_levels) *
+ tl = kzalloc((i + nr_levels + 1) *
sizeof(struct sched_domain_topology_level), GFP_KERNEL);
if (!tl)
return;