netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Ahern <dsahern@kernel.org>
To: Kuniyuki Iwashima <kuniyu@amazon.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Cc: Simon Horman <horms@kernel.org>,
	Kuniyuki Iwashima <kuni1840@gmail.com>,
	netdev@vger.kernel.org, syzkaller <syzkaller@googlegroups.com>,
	Yi Lai <yi1.lai@linux.intel.com>
Subject: Re: [PATCH v1 net-next] ipv6: Restore fib6_config validation for SIOCADDRT.
Date: Tue, 29 Apr 2025 09:31:33 -0600	[thread overview]
Message-ID: <86cf6035-c6d9-462c-9a9c-42a6d0368069@kernel.org> (raw)
In-Reply-To: <20250429014624.61938-1-kuniyu@amazon.com>

On 4/28/25 6:46 PM, Kuniyuki Iwashima wrote:
> diff --git a/net/ipv6/route.c b/net/ipv6/route.c
> index d0351e95d916..4c1e86e968f8 100644
> --- a/net/ipv6/route.c
> +++ b/net/ipv6/route.c
> @@ -4496,6 +4496,53 @@ void rt6_purge_dflt_routers(struct net *net)
>  	rcu_read_unlock();
>  }
>  
> +static int fib6_config_validate(struct fib6_config *cfg,
> +				struct netlink_ext_ack *extack)
> +{
> +	/* RTF_PCPU is an internal flag; can not be set by userspace */
> +	if (cfg->fc_flags & RTF_PCPU) {
> +		NL_SET_ERR_MSG(extack, "Userspace can not set RTF_PCPU");
> +		goto errout;
> +	}
> +
> +	/* RTF_CACHE is an internal flag; can not be set by userspace */
> +	if (cfg->fc_flags & RTF_CACHE) {
> +		NL_SET_ERR_MSG(extack, "Userspace can not set RTF_CACHE");
> +		goto errout;
> +	}
> +
> +	if (cfg->fc_type > RTN_MAX) {
> +		NL_SET_ERR_MSG(extack, "Invalid route type");
> +		goto errout;
> +	}
> +
> +	if (cfg->fc_dst_len > 128) {
> +		NL_SET_ERR_MSG(extack, "Invalid prefix length");
> +		goto errout;
> +	}
> +
> +#ifdef CONFIG_IPV6_SUBTREES
> +	if (cfg->fc_src_len > 128) {
> +		NL_SET_ERR_MSG(extack, "Invalid source address length");
> +		goto errout;
> +	}
> +
> +	if (cfg->fc_nh_id &&  cfg->fc_src_len) {

extra space after '&&'



Reviewed-by: David Ahern <dsahern@kernel.org>


  reply	other threads:[~2025-04-29 15:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-29  1:46 [PATCH v1 net-next] ipv6: Restore fib6_config validation for SIOCADDRT Kuniyuki Iwashima
2025-04-29 15:31 ` David Ahern [this message]
2025-05-01  0:48   ` Kuniyuki Iwashima
2025-04-30  1:59 ` kernel test robot
2025-04-30  3:20 ` kernel test robot

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=86cf6035-c6d9-462c-9a9c-42a6d0368069@kernel.org \
    --to=dsahern@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=kuni1840@gmail.com \
    --cc=kuniyu@amazon.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=syzkaller@googlegroups.com \
    --cc=yi1.lai@linux.intel.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;
as well as URLs for NNTP newsgroup(s).