Skip to content

Commit dc888cc

Browse files
rostedthemantbeast
authored andcommitted
sched: Use CPUPRI_NR_PRIORITIES instead of MAX_RT_PRIO in cpupri check
commit 6227cb00cc120f9a43ce8313bb0475ddabcb7d01 upstream. The check at the beginning of cpupri_find() makes sure that the task_pri variable does not exceed the cp->pri_to_cpu array length. But that length is CPUPRI_NR_PRIORITIES not MAX_RT_PRIO, where it will miss the last two priorities in that array. As task_pri is computed from convert_prio() which should never be bigger than CPUPRI_NR_PRIORITIES, if the check should cause a panic if it is hit. Change-Id: Idc7b4e236f26edeaea86aad255cfd810ac847630 Reported-by: Mike Galbraith <[email protected]> Signed-off-by: Steven Rostedt <[email protected]> Signed-off-by: Peter Zijlstra <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 4a6bca2 commit dc888cc

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

kernel/sched/cpupri.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,7 @@ int cpupri_find(struct cpupri *cp, struct task_struct *p,
6868
int idx = 0;
6969
int task_pri = convert_prio(p->prio);
7070

71-
if (task_pri >= MAX_RT_PRIO)
72-
return 0;
71+
BUG_ON(task_pri >= CPUPRI_NR_PRIORITIES);
7372

7473
for (idx = 0; idx < task_pri; idx++) {
7574
struct cpupri_vec *vec = &cp->pri_to_cpu[idx];

0 commit comments

Comments
 (0)