[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4ef76406-8e05-ccdf-fefb-dc47d56c71c9@gmail.com>
Date: Wed, 3 May 2017 12:22:35 -0600
From: David Ahern <dsahern@...il.com>
To: Cong Wang <xiyou.wangcong@...il.com>,
Andrey Konovalov <andreyknvl@...gle.com>
Cc: "David S. Miller" <davem@...emloft.net>,
Alexey Kuznetsov <kuznet@....inr.ac.ru>,
James Morris <jmorris@...ei.org>,
Hideaki YOSHIFUJI <yoshfuji@...ux-ipv6.org>,
Patrick McHardy <kaber@...sh.net>,
netdev <netdev@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>,
Dmitry Vyukov <dvyukov@...gle.com>,
Kostya Serebryany <kcc@...gle.com>,
Eric Dumazet <edumazet@...gle.com>,
syzkaller <syzkaller@...glegroups.com>
Subject: Re: net/ipv6: GPF in rt6_device_match
On 5/3/17 11:02 AM, Cong Wang wrote:
> A quick glance shows we need to simply check local->rt6i_idev
> since we do the same check for sprt right above.
As I recall, rt6i_idev is set for all routes except null_entry and it is
not set on null_entry only because of initialization order.
>
> diff --git a/net/ipv6/route.c b/net/ipv6/route.c
> index a1bf426..61ec3c8 100644
> --- a/net/ipv6/route.c
> +++ b/net/ipv6/route.c
> @@ -511,7 +511,7 @@ static inline struct rt6_info
> *rt6_device_match(struct net *net,
> sprt->rt6i_idev->dev->ifindex != oif) {
> if (flags & RT6_LOOKUP_F_IFACE)
> continue;
> - if (local &&
> + if (local && local->rt6i_idev &&
>
> local->rt6i_idev->dev->ifindex == oif)
> continue;
> }
>
Or don't consider null_entry at all:
@@ -515,7 +528,8 @@ static inline struct rt6_info
*rt6_device_match(struct net *net,
local->rt6i_idev->dev->ifindex == oif)
continue;
}
- local = sprt;
+ if (sprt != net->ipv6.ip6_null_entry)
+ local = sprt;
}
Powered by blists - more mailing lists