Subject: Re: [PATCH 5.4 096/156] net: sched: sch: Bounds check priority

From: Greg Kroah-Hartman <[email-masked]>
Date: Tue, 21 Feb 2023 09:41:35 +0100

On Tue, Feb 21, 2023 at 08:45:18AM +0100, Paolo Abeni wrote:
> Hello,
> 
> On Mon, 2023-02-20 at 14:35 +0100, Greg Kroah-Hartman wrote:
> > From: Kees Cook <[email-masked]>
> > 
> > [ Upstream commit de5ca4c3852f896cacac2bf259597aab5e17d9e3 ]
> > 
> > Nothing was explicitly bounds checking the priority index used to access
> > clpriop[]. WARN and bail out early if it's pathological. Seen with GCC 13:
> > 
> > ../net/sched/sch_htb.c: In function 'htb_activate_prios':
> > ../net/sched/sch_htb.c:437:44: warning: array subscript [0, 31] is outside array bounds of 'struct htb_prio[8]' [-Warray-bounds=]
> >   437 |                         if (p->inner.clprio[prio].feed.rb_node)
> >       |                             ~~~~~~~~~~~~~~~^~~~~~
> > ../net/sched/sch_htb.c:131:41: note: while referencing 'clprio'
> >   131 |                         struct htb_prio clprio[TC_HTB_NUMPRIO];
> >       |                                         ^~~~~~
> > 
> > Cc: Jamal Hadi Salim <[email-masked]>
> > Cc: Cong Wang <[email-masked]>
> > Cc: Jiri Pirko <[email-masked]>
> > Cc: "David S. Miller" <[email-masked]>
> > Cc: Eric Dumazet <[email-masked]>
> > Cc: Jakub Kicinski <[email-masked]>
> > Cc: Paolo Abeni <[email-masked]>
> > Cc: [email-masked]
> > Signed-off-by: Kees Cook <[email-masked]>
> > Reviewed-by: Simon Horman <[email-masked]>
> > Reviewed-by: Cong Wang <[email-masked]>
> > Link: https://lore.kernel.org/r/[email-masked]
> > Signed-off-by: Paolo Abeni <[email-masked]>
> > Signed-off-by: Sasha Levin <[email-masked]>
> 
> This one has a follow-up which I don't see among the patches reaching
> the netdev ML:
> 
> commit 9cec2aaffe969f2a3e18b5ec105fc20bb908e475
> Author: Dan Carpenter <[email-masked]>
> Date:   Mon Feb 6 16:18:32 2023 +0300
> 
>     net: sched: sch: Fix off by one in htb_activate_prios()

This too is in the queue for 5.4 and newer kernels, are you sure you
didn't miss that in this series?

thanks,

greg k-h