Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1639843
| From | Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 4.11 20/28] ipv6: reorder ip6_route_dev_notifier after ipv6_dev_notf |
| Date | 2017-05-11 18:10 +0200 |
| Message-ID | <tFYP9-7g-49@gated-at.bofh.it> (permalink) |
| References | <tFX6H-7p4-31@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
4.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: WANG Cong <xiyou.wangcong@gmail.com>
[ Upstream commit 242d3a49a2a1a71d8eb9f953db1bcaa9d698ce00 ]
For each netns (except init_net), we initialize its null entry
in 3 places:
1) The template itself, as we use kmemdup()
2) Code around dst_init_metrics() in ip6_route_net_init()
3) ip6_route_dev_notify(), which is supposed to initialize it after
loopback registers
Unfortunately the last one still happens in a wrong order because
we expect to initialize net->ipv6.ip6_null_entry->rt6i_idev to
net->loopback_dev's idev, thus we have to do that after we add
idev to loopback. However, this notifier has priority == 0 same as
ipv6_dev_notf, and ipv6_dev_notf is registered after
ip6_route_dev_notifier so it is called actually after
ip6_route_dev_notifier. This is similar to commit 2f460933f58e
("ipv6: initialize route null entry in addrconf_init()") which
fixes init_net.
Fix it by picking a smaller priority for ip6_route_dev_notifier.
Also, we have to release the refcnt accordingly when unregistering
loopback_dev because device exit functions are called before subsys
exit functions.
Acked-by: David Ahern <dsahern@gmail.com>
Tested-by: David Ahern <dsahern@gmail.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
include/net/addrconf.h | 2 ++
net/ipv6/addrconf.c | 1 +
net/ipv6/route.c | 13 +++++++++++--
3 files changed, 14 insertions(+), 2 deletions(-)
--- a/include/net/addrconf.h
+++ b/include/net/addrconf.h
@@ -20,6 +20,8 @@
#define ADDRCONF_TIMER_FUZZ (HZ / 4)
#define ADDRCONF_TIMER_FUZZ_MAX (HZ)
+#define ADDRCONF_NOTIFY_PRIORITY 0
+
#include <linux/in.h>
#include <linux/in6.h>
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -3516,6 +3516,7 @@ static int addrconf_notify(struct notifi
*/
static struct notifier_block ipv6_dev_notf = {
.notifier_call = addrconf_notify,
+ .priority = ADDRCONF_NOTIFY_PRIORITY,
};
static void addrconf_type_change(struct net_device *dev, unsigned long event)
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -3704,7 +3704,10 @@ static int ip6_route_dev_notify(struct n
struct net_device *dev = netdev_notifier_info_to_dev(ptr);
struct net *net = dev_net(dev);
- if (event == NETDEV_REGISTER && (dev->flags & IFF_LOOPBACK)) {
+ if (!(dev->flags & IFF_LOOPBACK))
+ return NOTIFY_OK;
+
+ if (event == NETDEV_REGISTER) {
net->ipv6.ip6_null_entry->dst.dev = dev;
net->ipv6.ip6_null_entry->rt6i_idev = in6_dev_get(dev);
#ifdef CONFIG_IPV6_MULTIPLE_TABLES
@@ -3713,6 +3716,12 @@ static int ip6_route_dev_notify(struct n
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) {
+ 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_blk_hole_entry->rt6i_idev);
+#endif
}
return NOTIFY_OK;
@@ -4019,7 +4028,7 @@ static struct pernet_operations ip6_rout
static struct notifier_block ip6_route_dev_notifier = {
.notifier_call = ip6_route_dev_notify,
- .priority = 0,
+ .priority = ADDRCONF_NOTIFY_PRIORITY - 10,
};
void __init ip6_route_init_special_entries(void)
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 4.11 00/28] 4.11.1-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-11 18:10 +0200
[PATCH 4.11 13/28] tcp: fix wraparound issue in tcp_lp Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-11 18:10 +0200
[PATCH 4.11 27/28] xen: Revert commits da72ff5bfcb0 and 72a9b186292d Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-11 18:10 +0200
[PATCH 4.11 18/28] rtnetlink: NUL-terminate IFLA_PHYS_PORT_NAME string Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-11 18:10 +0200
[PATCH 4.11 26/28] xen/arm,arm64: fix xen_dma_ops after 815dd18 "Consolidate get_dma_ops..." Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-11 18:10 +0200
[PATCH 4.11 06/28] sparc64: fix fault handling in NGbzero.S and GENbzero.S Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-11 18:10 +0200
[PATCH 4.11 28/28] block: get rid of blk_integrity_revalidate() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-11 18:10 +0200
[PATCH 4.11 08/28] net: macb: fix phy interrupt parsing Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-11 18:10 +0200
[PATCH 4.11 23/28] bpf: dont let ldimm64 leak map addresses on unprivileged Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-11 18:10 +0200
[PATCH 4.11 22/28] bnxt_en: allocate enough space for ->ntp_fltr_bmap Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-11 18:10 +0200
[PATCH 4.11 21/28] tcp: randomize timestamps on syncookies Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-11 18:10 +0200
[PATCH 4.11 14/28] net: ipv6: Do not duplicate DAD on link up Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-11 18:10 +0200
[PATCH 4.11 16/28] tcp: do not inherit fastopen_req from parent Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-11 18:10 +0200
[PATCH 4.11 20/28] ipv6: reorder ip6_route_dev_notifier after ipv6_dev_notf Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-11 18:10 +0200
[PATCH 4.11 09/28] tcp: fix access to sk->sk_state in tcp_poll() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-11 18:10 +0200
[PATCH 4.11 24/28] net: mdio-mux: bcm-iproc: call mdiobus_free() in error path Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-11 18:10 +0200
[PATCH 4.11 12/28] bpf, arm64: fix jit branch offset related to ldimm64 Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-11 18:10 +0200
[PATCH 4.11 17/28] ipv4, ipv6: ensure raw socket message is big enough to hold an IP header Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-11 18:10 +0200
[PATCH 4.11 19/28] ipv6: initialize route null entry in addrconf_init() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-11 18:10 +0200
Re: [PATCH 4.11 00/28] 4.11.1-stable review Shuah Khan <shuahkh@osg.samsung.com> - 2017-05-12 17:30 +0200
Re: [PATCH 4.11 00/28] 4.11.1-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-12 17:50 +0200
Re: [PATCH 4.11 00/28] 4.11.1-stable review Shuah Khan <shuahkh@osg.samsung.com> - 2017-05-12 18:10 +0200
Re: [PATCH 4.11 00/28] 4.11.1-stable review Matt Fleming <matt@codeblueprint.co.uk> - 2017-05-15 16:40 +0200
Re: [PATCH 4.11 00/28] 4.11.1-stable review Guenter Roeck <linux@roeck-us.net> - 2017-05-12 22:00 +0200
Re: [PATCH 4.11 00/28] 4.11.1-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-14 13:10 +0200
csiph-web