aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2025-09-03 11:10:36 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2025-09-03 11:10:36 -0700
commitec299e4dc21e8cc476c2c848813919db79492dda (patch)
treea50a63eb9194e6e9fffe528d10add30db3c4f6df
parentMerge tag 'sound-6.17-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound (diff)
parentsched: Fix sched_numa_find_nth_cpu() if mask offline (diff)
downloadwireguard-linux-ec299e4dc21e8cc476c2c848813919db79492dda.tar.xz
wireguard-linux-ec299e4dc21e8cc476c2c848813919db79492dda.zip
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
-rw-r--r--kernel/sched/topology.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c
index 977e133bb8a4..6e2f54169e66 100644
--- a/kernel/sched/topology.c
+++ b/kernel/sched/topology.c
@@ -2201,6 +2201,8 @@ int sched_numa_find_nth_cpu(const struct cpumask *cpus, int cpu, int node)
goto unlock;
hop_masks = bsearch(&k, k.masks, sched_domains_numa_levels, sizeof(k.masks[0]), hop_cmp);
+ if (!hop_masks)
+ goto unlock;
hop = hop_masks - k.masks;
ret = hop ?