[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <bca0aca50914367fffccf33b2f2ac880808d6cd9.camel@redhat.com>
Date: Thu, 19 Oct 2023 12:35:30 +0200
From: Paolo Abeni <pabeni@...hat.com>
To: Gerhard Engleder <gerhard@...leder-embedded.com>,
Lai Peter Jun Ann <jun.ann.lai@...el.com>,
Vinicius Costa Gomes <vinicius.gomes@...el.com>,
Jamal Hadi Salim <jhs@...atatu.com>,
Cong Wang <xiyou.wangcong@...il.com>,
Jiri Pirko <jiri@...nulli.us>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>
Cc: netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH net-next v2 1/1] taprio: Add boundary check for
sched-entry values
On Wed, 2023-10-18 at 19:56 +0200, Gerhard Engleder wrote:
> On 18.10.23 05:28, Lai Peter Jun Ann wrote:
> > Adds boundary checks for the gatemask provided against the number of
> > traffic class defined for each sched-entry.
> >
> > Without this check, the user would not know that the gatemask provided is
> > invalid and the driver has already truncated the gatemask provided to
> > match the number of traffic class defined.
> >
> > Signed-off-by: Muhammad Husaini Zulkifli <muhammad.husaini.zulkifli@...el.com>
> > Signed-off-by: Michael Sit Wei Hong <michael.wei.hong.sit@...el.com>
> > Signed-off-by: Lai Peter Jun Ann <jun.ann.lai@...el.com>
> > ---
> > net/sched/sch_taprio.c | 8 ++++++++
> > 1 file changed, 8 insertions(+)
> >
> > diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c
> > index 1cb5e41..44b9e21 100644
> > --- a/net/sched/sch_taprio.c
> > +++ b/net/sched/sch_taprio.c
> > @@ -102,6 +102,7 @@ struct taprio_sched {
> > u32 max_sdu[TC_MAX_QUEUE]; /* save info from the user */
> > u32 fp[TC_QOPT_MAX_QUEUE]; /* only for dump and offloading */
> > u32 txtime_delay;
> > + u8 num_tc;
> > };
> >
> > struct __tc_taprio_qopt_offload {
> > @@ -1063,6 +1064,11 @@ static int fill_sched_entry(struct taprio_sched *q, struct nlattr **tb,
> > return -EINVAL;
> > }
> >
> > + if (entry->gate_mask >= q->num_tc) {
>
> As far as I know within gate_mask every bit represents a traffic class.
> So for 3 traffic classes at gate_mask of 0x7 is valid but this check
> fails with 0x7 >= 3.
Additionally whatever check we put in place previously just ignored by
the existing code, could break the existing user-space: we can't accept
such change.
Cheers,
Paolo
Powered by blists - more mailing lists