From 549182cc26c6e76d9cfd220327c24fb2f0d4574b Mon Sep 17 00:00:00 2001 From: "Boppana Prasad, Rajendra" <rajendra.b@intel.com> Date: Tue, 5 Jun 2018 12:59:54 +0200 Subject: [PATCH] Merge pull request #16 in SW_UGW/linux from bugfix/UGW_SW-26630-cst-8.x-ftp-login-is-not-successful to ugw-grx500-linux-4.9.y Fix on top of openwrt kernel patch 670-ipv6-allow-rejecting-with-source-address-failed-policy.patch which adds ip6_policy_failed_entry, but if it only ever calls in6_dev_get, which increments the refs we also need to call in6_dev_put to decrement the refs * commit '520b592f5b2901591efe76853fa8be12ad260b84': Revert "Merge pull request #15 in SW_UGW/linux from bugfix/UGW_SW-26630-cst-8.x-ftp-login-is-not-successful to ugw-grx500-linux-4.9.y" UGW_SW-26630-Fix openwrt kernel patch 670-ipv6-allow-rejecting-with-source-address-failed-policy.patch adds ip6_policy_failed_entry, but if it only ever calls in6_dev_get, which increments the refs we also need to call in6_dev_put to decrement the refs --- net/ipv6/route.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/net/ipv6/route.c b/net/ipv6/route.c index b17d167d8..ae81893b3 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -3541,10 +3541,15 @@ static int ip6_route_dev_notify(struct notifier_block *this, net->ipv6.ip6_blk_hole_entry->dst.dev = dev; net->ipv6.ip6_blk_hole_entry->rt6i_idev = in6_dev_get(dev); #endif - } else if (event == NETDEV_UNREGISTER) { + } else if (event == NETDEV_UNREGISTER && + dev->reg_state != NETREG_UNREGISTERED) { + /* NETDEV_UNREGISTER could be fired for multiple times by + * netdev_wait_allrefs(). Make sure we only call this once. + */ in6_dev_put(net->ipv6.ip6_null_entry->rt6i_idev); #ifdef CONFIG_IPV6_MULTIPLE_TABLES in6_dev_put(net->ipv6.ip6_prohibit_entry->rt6i_idev); + in6_dev_put(net->ipv6.ip6_policy_failed_entry->rt6i_idev); in6_dev_put(net->ipv6.ip6_blk_hole_entry->rt6i_idev); #endif } -- GitLab