Skip to content

Commit ec299e4

Browse files
committed
Merge tag 'bitmap-for-6.17-rc5' of https://github.com/norov/linux
Pull bitmap fix from Yury Norov: "Fix sched_numa_find_nth_cpu() if mask offline sched_numa_find_nth_cpu() uses a bsearch to look for the 'closest' CPU in sched_domains_numa_masks and given cpus mask. However they might not intersect if all CPUs in the cpus mask are offline. bsearch will return NULL in that case, bail out instead of dereferencing a bogus pointer" * tag 'bitmap-for-6.17-rc5' of https://github.com/norov/linux: sched: Fix sched_numa_find_nth_cpu() if mask offline
2 parents e6b9dce + 5ebf512 commit ec299e4

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

kernel/sched/topology.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2201,6 +2201,8 @@ int sched_numa_find_nth_cpu(const struct cpumask *cpus, int cpu, int node)
22012201
goto unlock;
22022202

22032203
hop_masks = bsearch(&k, k.masks, sched_domains_numa_levels, sizeof(k.masks[0]), hop_cmp);
2204+
if (!hop_masks)
2205+
goto unlock;
22042206
hop = hop_masks - k.masks;
22052207

22062208
ret = hop ?

0 commit comments

Comments
 (0)