[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <86cf6035-c6d9-462c-9a9c-42a6d0368069@kernel.org>
Date: Tue, 29 Apr 2025 09:31:33 -0600
From: David Ahern <dsahern@...nel.org>
To: Kuniyuki Iwashima <kuniyu@...zon.com>,
"David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>
Cc: Simon Horman <horms@...nel.org>, Kuniyuki Iwashima <kuni1840@...il.com>,
netdev@...r.kernel.org, syzkaller <syzkaller@...glegroups.com>,
Yi Lai <yi1.lai@...ux.intel.com>
Subject: Re: [PATCH v1 net-next] ipv6: Restore fib6_config validation for
SIOCADDRT.
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@...nel.org>
Powered by blists - more mailing lists