* [PATCH net-next] net: sched: sch: Fix off by one in htb_activate_prios()
@ 2023-02-06 13:18 Dan Carpenter
2023-02-06 14:15 ` Simon Horman
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Dan Carpenter @ 2023-02-06 13:18 UTC (permalink / raw)
To: Jamal Hadi Salim, Kees Cook
Cc: Cong Wang, Jiri Pirko, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Simon Horman, netdev,
kernel-janitors
The > needs be >= to prevent an out of bounds access.
Fixes: de5ca4c3852f ("net: sched: sch: Bounds check priority")
Signed-off-by: Dan Carpenter <error27@gmail.com>
---
net/sched/sch_htb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c
index cc28e41fb745..92f2975b6a82 100644
--- a/net/sched/sch_htb.c
+++ b/net/sched/sch_htb.c
@@ -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);
--
2.35.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH net-next] net: sched: sch: Fix off by one in htb_activate_prios()
2023-02-06 13:18 [PATCH net-next] net: sched: sch: Fix off by one in htb_activate_prios() Dan Carpenter
@ 2023-02-06 14:15 ` Simon Horman
2023-02-06 18:39 ` Kees Cook
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Simon Horman @ 2023-02-06 14:15 UTC (permalink / raw)
To: Dan Carpenter
Cc: Jamal Hadi Salim, Kees Cook, Cong Wang, Jiri Pirko,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
netdev, kernel-janitors
On Mon, Feb 06, 2023 at 04:18:32PM +0300, Dan Carpenter wrote:
> The > needs be >= to prevent an out of bounds access.
>
> Fixes: de5ca4c3852f ("net: sched: sch: Bounds check priority")
> Signed-off-by: Dan Carpenter <error27@gmail.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net-next] net: sched: sch: Fix off by one in htb_activate_prios()
2023-02-06 13:18 [PATCH net-next] net: sched: sch: Fix off by one in htb_activate_prios() Dan Carpenter
2023-02-06 14:15 ` Simon Horman
@ 2023-02-06 18:39 ` Kees Cook
2023-02-08 4:16 ` Jakub Kicinski
2023-02-08 7:50 ` patchwork-bot+netdevbpf
3 siblings, 0 replies; 6+ messages in thread
From: Kees Cook @ 2023-02-06 18:39 UTC (permalink / raw)
To: Dan Carpenter
Cc: Jamal Hadi Salim, Cong Wang, Jiri Pirko, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Simon Horman, netdev,
kernel-janitors
On Mon, Feb 06, 2023 at 04:18:32PM +0300, Dan Carpenter wrote:
> The > needs be >= to prevent an out of bounds access.
>
> Fixes: de5ca4c3852f ("net: sched: sch: Bounds check priority")
> Signed-off-by: Dan Carpenter <error27@gmail.com>
> ---
> net/sched/sch_htb.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c
> index cc28e41fb745..92f2975b6a82 100644
> --- a/net/sched/sch_htb.c
> +++ b/net/sched/sch_htb.c
> @@ -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)))
Argh, whoops. Thanks Dan!
Reviewed-by: Kees Cook <keescook@chromium.org>
--
Kees Cook
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net-next] net: sched: sch: Fix off by one in htb_activate_prios()
2023-02-06 13:18 [PATCH net-next] net: sched: sch: Fix off by one in htb_activate_prios() Dan Carpenter
2023-02-06 14:15 ` Simon Horman
2023-02-06 18:39 ` Kees Cook
@ 2023-02-08 4:16 ` Jakub Kicinski
2023-02-08 6:18 ` Dan Carpenter
2023-02-08 7:50 ` patchwork-bot+netdevbpf
3 siblings, 1 reply; 6+ messages in thread
From: Jakub Kicinski @ 2023-02-08 4:16 UTC (permalink / raw)
To: Dan Carpenter
Cc: Jamal Hadi Salim, Kees Cook, Cong Wang, Jiri Pirko,
David S. Miller, Eric Dumazet, Paolo Abeni, Simon Horman, netdev,
kernel-janitors
On Mon, 6 Feb 2023 16:18:32 +0300 Dan Carpenter wrote:
> Subject: [PATCH net-next] net: sched: sch: Fix off by one in htb_activate_prios()
Thanks for tagging but just to be sure - this is for net, right?
(no need to repost)
> The > needs be >= to prevent an out of bounds access.
>
> Fixes: de5ca4c3852f ("net: sched: sch: Bounds check priority")
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net-next] net: sched: sch: Fix off by one in htb_activate_prios()
2023-02-08 4:16 ` Jakub Kicinski
@ 2023-02-08 6:18 ` Dan Carpenter
0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2023-02-08 6:18 UTC (permalink / raw)
To: Jakub Kicinski
Cc: Jamal Hadi Salim, Kees Cook, Cong Wang, Jiri Pirko,
David S. Miller, Eric Dumazet, Paolo Abeni, Simon Horman, netdev,
kernel-janitors
On Tue, Feb 07, 2023 at 08:16:03PM -0800, Jakub Kicinski wrote:
> On Mon, 6 Feb 2023 16:18:32 +0300 Dan Carpenter wrote:
> > Subject: [PATCH net-next] net: sched: sch: Fix off by one in htb_activate_prios()
>
> Thanks for tagging but just to be sure - this is for net, right?
> (no need to repost)
>
Yes. And I did verify before sending that it applied to net, but I
still put net-next in the subject because I'm an idiot.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net-next] net: sched: sch: Fix off by one in htb_activate_prios()
2023-02-06 13:18 [PATCH net-next] net: sched: sch: Fix off by one in htb_activate_prios() Dan Carpenter
` (2 preceding siblings ...)
2023-02-08 4:16 ` Jakub Kicinski
@ 2023-02-08 7:50 ` patchwork-bot+netdevbpf
3 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-02-08 7:50 UTC (permalink / raw)
To: Dan Carpenter
Cc: jhs, keescook, xiyou.wangcong, jiri, davem, edumazet, kuba,
pabeni, simon.horman, netdev, kernel-janitors
Hello:
This patch was applied to netdev/net.git (master)
by Jakub Kicinski <kuba@kernel.org>:
On Mon, 6 Feb 2023 16:18:32 +0300 you wrote:
> The > needs be >= to prevent an out of bounds access.
>
> Fixes: de5ca4c3852f ("net: sched: sch: Bounds check priority")
> Signed-off-by: Dan Carpenter <error27@gmail.com>
> ---
> net/sched/sch_htb.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Here is the summary with links:
- [net-next] net: sched: sch: Fix off by one in htb_activate_prios()
https://git.kernel.org/netdev/net/c/9cec2aaffe96
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2023-02-08 7:50 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-06 13:18 [PATCH net-next] net: sched: sch: Fix off by one in htb_activate_prios() Dan Carpenter
2023-02-06 14:15 ` Simon Horman
2023-02-06 18:39 ` Kees Cook
2023-02-08 4:16 ` Jakub Kicinski
2023-02-08 6:18 ` Dan Carpenter
2023-02-08 7:50 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).