netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Ahern <dsahern@gmail.com>
To: Ido Schimmel <idosch@idosch.org>
Cc: netdev@vger.kernel.org, davem@davemloft.net, mlxsw@mellanox.com,
	Ido Schimmel <idosch@mellanox.com>
Subject: Re: [PATCH net-next] ipv6: Check if route exists before notifying it
Date: Wed, 19 Jun 2019 13:54:25 -0600	[thread overview]
Message-ID: <a2e5e94e-fa52-ffbf-f6f0-3a2189d6be77@gmail.com> (raw)
In-Reply-To: <20190619194058.GA8498@splinter>

On 6/19/19 1:40 PM, Ido Schimmel wrote:
> On Wed, Jun 19, 2019 at 01:10:08PM -0600, David Ahern wrote:
>> On 6/19/19 11:55 AM, Ido Schimmel wrote:
>>> diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c
>>> index 1d16a01eccf5..241a0e9a07c3 100644
>>> --- a/net/ipv6/ip6_fib.c
>>> +++ b/net/ipv6/ip6_fib.c
>>> @@ -393,6 +393,8 @@ int call_fib6_multipath_entry_notifiers(struct net *net,
>>>  		.nsiblings = nsiblings,
>>>  	};
>>>  
>>> +	if (!rt)
>>> +		return -EINVAL;
>>>  	rt->fib6_table->fib_seq++;
>>>  	return call_fib6_notifiers(net, event_type, &info.info);
>>>  }
>>
>> The call to call_fib6_multipath_entry_notifiers in
>> ip6_route_multipath_add happens without rt_notif set because the MPATH
>> spec is empty? 
> 
> There is a nexthop in the syzbot reproducer, but its length is shorter
> than sizeof(struct rtnexthop).

hmmm... I would expect that to be caught by the 'while (rtnh_ok(rtnh,
remaining)) {}' loop.

For the loop 'list_for_each_entry(nh, &rt6_nh_list, next) {}' if the
list is empty then yes, rt_notif is null which should be caught and
handled with EINVAL/extack. If there is at least 1 entry in the list,
rt_notif is set (success adding to fib) or it jumps over the notifier to
add_errout.

> 
>> It seems like that check should be done in ip6_route_multipath_add
>> rather than call_fib6_multipath_entry_notifiers with an extack saying
>> the reason for the failure.
> 
> It seemed consistent with ip6_route_mpath_notify(). We can check if
> rt6_nh_list is empty and send a proper error message. I'll do that
> tomorrow morning since it's already late here.
> 

ok.


      reply	other threads:[~2019-06-19 19:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-19 17:55 [PATCH net-next] ipv6: Check if route exists before notifying it Ido Schimmel
2019-06-19 19:10 ` David Ahern
2019-06-19 19:40   ` Ido Schimmel
2019-06-19 19:54     ` David Ahern [this message]

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=a2e5e94e-fa52-ffbf-f6f0-3a2189d6be77@gmail.com \
    --to=dsahern@gmail.com \
    --cc=davem@davemloft.net \
    --cc=idosch@idosch.org \
    --cc=idosch@mellanox.com \
    --cc=mlxsw@mellanox.com \
    --cc=netdev@vger.kernel.org \
    /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).