Skip to content

Commit

Permalink
net: sched: sch: Fix off by one in htb_activate_prios()
Browse files Browse the repository at this point in the history
commit 9cec2aa upstream.

The > needs be >= to prevent an out of bounds access.

Fixes: de5ca4c ("net: sched: sch: Bounds check priority")
Signed-off-by: Dan Carpenter <error27@gmail.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/Y+D+KN18FQI2DKLq@kili
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Dan Carpenter authored and Greg Kroah-Hartman committed Feb 22, 2023
1 parent 0c89a43 commit 4419cb8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/sched/sch_htb.c
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ static void htb_activate_prios(struct htb_sched *q, struct htb_class *cl)
while (m) {
unsigned int prio = ffz(~m);

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

Expand Down

0 comments on commit 4419cb8

Please sign in to comment.