Skip to content

Commit 9cec2aa

Browse files
error27kuba-moo
authored andcommitted
net: sched: sch: Fix off by one in htb_activate_prios()
The > needs be >= to prevent an out of bounds access. Fixes: de5ca4c ("net: sched: sch: Bounds check priority") Signed-off-by: Dan Carpenter <[email protected]> Reviewed-by: Simon Horman <[email protected]> Reviewed-by: Kees Cook <[email protected]> Link: https://lore.kernel.org/r/Y+D+KN18FQI2DKLq@kili Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 91701f6 commit 9cec2aa

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/sched/sch_htb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ static void htb_activate_prios(struct htb_sched *q, struct htb_class *cl)
433433
while (m) {
434434
unsigned int prio = ffz(~m);
435435

436-
if (WARN_ON_ONCE(prio > ARRAY_SIZE(p->inner.clprio)))
436+
if (WARN_ON_ONCE(prio >= ARRAY_SIZE(p->inner.clprio)))
437437
break;
438438
m &= ~(1 << prio);
439439

0 commit comments

Comments
 (0)