Message ID | CAEA6p_AOcNkAWPc7NFBnr8QWi3eHdJiQ2=8D_DB_XthwSDL2+Q@mail.gmail.com |
---|---|
State | RFC, archived |
Delegated to: | David Miller |
Headers | show |
On Wed, Aug 9, 2017 at 10:41 PM, Wei Wang <weiwan@google.com> wrote: > Hi John, > > Is it possible to try the attached patch? Thanks so much for the quick turn around! So I dropped all the reverts you suggested, and applied this one against 4.13-rc4, but I'm still seeing the problematic behavior. > I am not sure if it actually fixes the issue. But I think it is worth a try. > Also, could you get me all the ipv6 routes when you plug in the usb > using "ip -6 route show"? (If you have multiple routing tables > configured, could you dump them all?) # ip -6 route show 2601:1c2:1002:83f0::/64 dev eth0 proto kernel metric 256 expires 345599sec pref medium fe80::/64 dev eth0 proto kernel metric 256 pref medium default via fe80::200:caff:fe11:2233 dev eth0 proto ra metric 1024 expires 1799sec hoplimit 64 pref medium After unplugging the device (and getting the unregister_netdevice errors): # ip -6 route show # thanks -john
On Thu, Aug 10, 2017 at 11:12 AM, John Stultz <john.stultz@linaro.org> wrote: > On Wed, Aug 9, 2017 at 10:41 PM, Wei Wang <weiwan@google.com> wrote: >> Hi John, >> >> Is it possible to try the attached patch? > > Thanks so much for the quick turn around! > > So I dropped all the reverts you suggested, and applied this one > against 4.13-rc4, but I'm still seeing the problematic behavior. > Thanks for confirming. I have been going through the code and not yet found any leaks. I am also trying to reproduce the issue myself. Martin seems to also see this issue. I will continue investigating. >> I am not sure if it actually fixes the issue. But I think it is worth a try. >> Also, could you get me all the ipv6 routes when you plug in the usb >> using "ip -6 route show"? (If you have multiple routing tables >> configured, could you dump them all?) > > # ip -6 route show > 2601:1c2:1002:83f0::/64 dev eth0 proto kernel metric 256 expires > 345599sec pref medium > fe80::/64 dev eth0 proto kernel metric 256 pref medium > default via fe80::200:caff:fe11:2233 dev eth0 proto ra metric 1024 > expires 1799sec hoplimit 64 pref medium > > > After unplugging the device (and getting the unregister_netdevice errors): > # ip -6 route show > # > Thanks for the logs. > > thanks > -john
From 93f2836679c81915b110ff56617f9f5dae2e6927 Mon Sep 17 00:00:00 2001 From: Wei Wang <weiwan@google.com> Date: Wed, 9 Aug 2017 22:27:36 -0700 Subject: [PATCH] ipv6: unregister netdev bug fix Change-Id: I30fa739989ac50fbc7f4cbc6a04130005589cc25 --- include/net/ip6_route.h | 1 + net/ipv6/addrconf.c | 10 +++++++--- net/ipv6/anycast.c | 3 ++- net/ipv6/route.c | 2 +- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h index 907d39a42f6b..dec1424ce619 100644 --- a/include/net/ip6_route.h +++ b/include/net/ip6_route.h @@ -94,6 +94,7 @@ int ipv6_route_ioctl(struct net *net, unsigned int cmd, void __user *arg); int ip6_route_add(struct fib6_config *cfg, struct netlink_ext_ack *extack); int ip6_ins_rt(struct rt6_info *); int ip6_del_rt(struct rt6_info *); +void rt6_uncached_list_add(struct rt6_info *rt); static inline int ip6_route_get_saddr(struct net *net, struct rt6_info *rt, const struct in6_addr *daddr, diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 3c46e9513a31..06a27addb93c 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c @@ -3079,7 +3079,8 @@ static void init_loopback(struct net_device *dev) /* Failure cases are ignored */ if (!IS_ERR(sp_rt)) { sp_ifa->rt = sp_rt; - ip6_ins_rt(sp_rt); + if (ip6_ins_rt(sp_rt)) + rt6_uncached_list_add(sp_rt); } } read_unlock_bh(&idev->lock); @@ -3711,6 +3712,7 @@ static int addrconf_ifdown(struct net_device *dev, int how) rt = ifa->rt; ifa->rt = NULL; } else { + rt6_uncached_list_add(ifa->rt); state = ifa->state; ifa->state = INET6_IFADDR_STATE_DEAD; } @@ -3882,7 +3884,8 @@ static void addrconf_dad_begin(struct inet6_ifaddr *ifp) * Frames right away */ if (ifp->flags & IFA_F_OPTIMISTIC) { - ip6_ins_rt(ifp->rt); + if (ip6_ins_rt(ifp->rt)) + rt6_uncached_list_add(ifp->rt); if (ipv6_use_optimistic_addr(idev)) { /* Because optimistic nodes can use this address, * notify listeners. If DAD fails, RTM_DELADDR is sent. @@ -5557,7 +5560,8 @@ static void __ipv6_ifa_notify(int event, struct inet6_ifaddr *ifp) * to do it again */ if (!(ifp->rt->rt6i_node)) - ip6_ins_rt(ifp->rt); + if(ip6_ins_rt(ifp->rt)) + rt6_uncached_list_add(ifp->rt); if (ifp->idev->cnf.forwarding) addrconf_join_anycast(ifp); if (!ipv6_addr_any(&ifp->peer_addr)) diff --git a/net/ipv6/anycast.c b/net/ipv6/anycast.c index 0bbab8a4b5d8..e21c2d6d9b95 100644 --- a/net/ipv6/anycast.c +++ b/net/ipv6/anycast.c @@ -283,7 +283,8 @@ int __ipv6_dev_ac_inc(struct inet6_dev *idev, const struct in6_addr *addr) aca_get(aca); write_unlock_bh(&idev->lock); - ip6_ins_rt(rt); + if (!ip6_ins_rt(rt)) + rt6_uncached_list_add(rt); addrconf_join_solict(idev->dev, &aca->aca_addr); diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 4d30c96a819d..7a7299da4e09 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -124,7 +124,7 @@ struct uncached_list { static DEFINE_PER_CPU_ALIGNED(struct uncached_list, rt6_uncached_list); -static void rt6_uncached_list_add(struct rt6_info *rt) +void rt6_uncached_list_add(struct rt6_info *rt) { struct uncached_list *ul = raw_cpu_ptr(&rt6_uncached_list); -- 2.14.0.434.g98096fd7a8-goog