public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Ido Schimmel <idosch@nvidia.com>
To: David Ahern <dsahern@kernel.org>
Cc: netdev@vger.kernel.org, davem@davemloft.net, kuba@kernel.org,
	pabeni@redhat.com, edumazet@google.com, petrm@nvidia.com
Subject: Re: [PATCH net-next v2 3/4] nexthop: Fix out-of-bounds access during attribute validation
Date: Wed, 13 Mar 2024 09:58:47 +0200	[thread overview]
Message-ID: <ZfFctzVnPpwsx1BJ@shredder> (raw)
In-Reply-To: <2a064df1-9c43-4224-aa35-6c7939852d1b@kernel.org>

On Mon, Mar 11, 2024 at 09:28:30PM -0600, David Ahern wrote:
> On 3/11/24 10:23 AM, Ido Schimmel wrote:
> Reviewed-by: David Ahern <dsahern@kernel.org>

Thanks!

> 
> 
> > diff --git a/tools/testing/selftests/net/fib_nexthops.sh b/tools/testing/selftests/net/fib_nexthops.sh
> > index d5a281aadbac..ac0b2c6a5761 100755
> > --- a/tools/testing/selftests/net/fib_nexthops.sh
> > +++ b/tools/testing/selftests/net/fib_nexthops.sh
> > @@ -2066,6 +2066,12 @@ basic()
> >  	run_cmd "$IP nexthop get id 1"
> >  	log_test $? 2 "Nexthop get on non-existent id"
> >  
> > +	run_cmd "$IP nexthop del id 1"
> > +	log_test $? 2 "Nexthop del with non-existent id"
> > +
> > +	run_cmd "$IP nexthop del id 1 group 1/2/3/4/5/6/7/8"
> > +	log_test $? 2 "Nexthop del with non-existent id and extra attributes"
> > +
> >  	# attempt to create nh without a device or gw - fails
> >  	run_cmd "$IP nexthop add id 1"
> >  	log_test $? 2 "Nexthop with no device or gateway"
> 
> The basic() group of tests do not have a delete, so this is a good
> addition. However, the ipv6_fcnal and ipv4_fcnal do have a del - seems
> like those tests should have caught the out of bounds access.

There are deletion tests, but they only provide the nexthop ID and the
purpose of providing some bogus attribute ("group" in this case) was to
trigger the out-of-bounds access in validate_nla():

pt = &policy[type];

As rtm_nh_policy_del does not contain an entry for NHA_GROUP.

  reply	other threads:[~2024-03-13  7:58 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-11 16:23 [PATCH net-next v2 0/4] nexthop: Fix two nexthop group statistics issues Ido Schimmel
2024-03-11 16:23 ` [PATCH net-next v2 1/4] nexthop: Only parse NHA_OP_FLAGS for get messages that require it Ido Schimmel
2024-03-12  3:26   ` David Ahern
2024-03-11 16:23 ` [PATCH net-next v2 2/4] nexthop: Only parse NHA_OP_FLAGS for dump " Ido Schimmel
2024-03-12  3:26   ` David Ahern
2024-03-11 16:23 ` [PATCH net-next v2 3/4] nexthop: Fix out-of-bounds access during attribute validation Ido Schimmel
2024-03-12  3:28   ` David Ahern
2024-03-13  7:58     ` Ido Schimmel [this message]
2024-03-11 16:23 ` [PATCH net-next v2 4/4] nexthop: Fix splat with CONFIG_DEBUG_PREEMPT=y Ido Schimmel
2024-03-12  3:28   ` David Ahern
2024-03-12  3:40 ` [PATCH net-next v2 0/4] nexthop: Fix two nexthop group statistics issues patchwork-bot+netdevbpf

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=ZfFctzVnPpwsx1BJ@shredder \
    --to=idosch@nvidia.com \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=petrm@nvidia.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