Commit 71e5f664 authored by Dietmar Eggemann's avatar Dietmar Eggemann Committed by Ingo Molnar

sched/topology: Fix sched_domain_topology_level alloc in sched_init_numa()

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: default avatarDietmar Eggemann <dietmar.eggemann@arm.com>
Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
Tested-by: default avatarVincent Guittot <vincent.guittot@linaro.org>
Tested-by: default avatarBarry Song <song.bao.hua@hisilicon.com>
Link: https://lkml.kernel.org/r/6000e39e-7d28-c360-9cd6-8798fd22a9bf@arm.com
parent 798172b1
...@@ -1702,7 +1702,7 @@ void sched_init_numa(void) ...@@ -1702,7 +1702,7 @@ void sched_init_numa(void)
/* Compute default topology size */ /* Compute default topology size */
for (i = 0; sched_domain_topology[i].mask; i++); 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); sizeof(struct sched_domain_topology_level), GFP_KERNEL);
if (!tl) if (!tl)
return; return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment