mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paolo Abeni <pabeni@redhat.com>
To: Gerhard Engleder <gerhard@engleder-embedded.com>,
	Lai Peter Jun Ann <jun.ann.lai@intel.com>,
	Vinicius Costa Gomes <vinicius.gomes@intel.com>,
	Jamal Hadi Salim <jhs@mojatatu.com>,
	Cong Wang <xiyou.wangcong@gmail.com>,
	Jiri Pirko <jiri@resnulli.us>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v2 1/1] taprio: Add boundary check for sched-entry values
Date: Thu, 19 Oct 2023 12:35:30 +0200	[thread overview]
Message-ID: <bca0aca50914367fffccf33b2f2ac880808d6cd9.camel@redhat.com> (raw)
In-Reply-To: <27912b49-eb1a-4100-a260-03299e8efdd4@engleder-embedded.com>

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@intel.com>
> > Signed-off-by: Michael Sit Wei Hong <michael.wei.hong.sit@intel.com>
> > Signed-off-by: Lai Peter Jun Ann <jun.ann.lai@intel.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


  reply	other threads:[~2023-10-19 10:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-18  3:28 Lai Peter Jun Ann
2023-10-18 17:56 ` Gerhard Engleder
2023-10-19 10:35   ` Paolo Abeni [this message]
2023-10-19 12:42     ` Vladimir Oltean

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bca0aca50914367fffccf33b2f2ac880808d6cd9.camel@redhat.com \
    --to=pabeni@redhat.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=gerhard@engleder-embedded.com \
    --cc=jhs@mojatatu.com \
    --cc=jiri@resnulli.us \
    --cc=jun.ann.lai@intel.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=vinicius.gomes@intel.com \
    --cc=xiyou.wangcong@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®