[tip: sched/core] sched/topology: Fix sched_domain_topology_level alloc in sched_init_numa()
From: tip-bot2 for Dietmar Eggemann
Date: Tue Feb 02 2021 - 05:05:23 EST
The following commit has been merged into the sched/core branch of tip:
Commit-ID: e972d92d52a1f691498add14feb2ee5902d02404
Gitweb: https://git.kernel.org/tip/e972d92d52a1f691498add14feb2ee5902d02404
Author: Dietmar Eggemann <dietmar.eggemann@xxxxxxx>
AuthorDate: Mon, 01 Feb 2021 10:53:53 +01:00
Committer: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
CommitterDate: Mon, 01 Feb 2021 15:31:39 +01:00
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: Dietmar Eggemann <dietmar.eggemann@xxxxxxx>
Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
Tested-by: Vincent Guittot <vincent.guittot@xxxxxxxxxx>
Tested-by: Barry Song <song.bao.hua@xxxxxxxxxxxxx>
Link: https://lkml.kernel.org/r/6000e39e-7d28-c360-9cd6-8798fd22a9bf@xxxxxxx
---
kernel/sched/topology.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c
index bf5c9bd..09d3504 100644
--- a/kernel/sched/topology.c
+++ b/kernel/sched/topology.c
@@ -1702,7 +1702,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;