Skip to content

Commit 6cd0c58

Browse files
Yi WangIngo Molnar
authored andcommitted
sched/topology: Check variable group before dereferencing it
The 'group' variable in sched_domain_debug_one() is not checked when firstly used in cpumask_test_cpu(cpu, sched_group_span(group)), but it might be NULL (it is checked later in the following while loop) and may cause NULL pointer dereference. We need to check it before using to avoid NULL dereference. Signed-off-by: Yi Wang <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Reviewed-by: Jiang Biao <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: [email protected] Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
1 parent d72e90f commit 6cd0c58

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kernel/sched/topology.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ static int sched_domain_debug_one(struct sched_domain *sd, int cpu, int level,
4747
if (!cpumask_test_cpu(cpu, sched_domain_span(sd))) {
4848
printk(KERN_ERR "ERROR: domain->span does not contain CPU%d\n", cpu);
4949
}
50-
if (!cpumask_test_cpu(cpu, sched_group_span(group))) {
50+
if (group && !cpumask_test_cpu(cpu, sched_group_span(group))) {
5151
printk(KERN_ERR "ERROR: domain->groups does not contain CPU%d\n", cpu);
5252
}
5353

0 commit comments

Comments
 (0)