Commit 9cec2aaf authored by Dan Carpenter's avatar Dan Carpenter Committed by Jakub Kicinski

net: sched: sch: Fix off by one in htb_activate_prios()

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

Fixes: de5ca4c3 ("net: sched: sch: Bounds check priority")
Signed-off-by: default avatarDan Carpenter <error27@gmail.com>
Reviewed-by: default avatarSimon Horman <simon.horman@corigine.com>
Reviewed-by: default avatarKees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/Y+D+KN18FQI2DKLq@kiliSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 91701f63
......@@ -433,7 +433,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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment