stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Andrey Konovalov <andreyknvl@google.com>,
	Cong Wang <xiyou.wangcong@gmail.com>,
	"David S. Miller" <davem@davemloft.net>
Subject: [PATCH 4.9 093/103] ipv6: initialize route null entry in addrconf_init()
Date: Thu, 11 May 2017 16:13:02 +0200	[thread overview]
Message-ID: <20170511141217.759134446@linuxfoundation.org> (raw)
In-Reply-To: <20170511141210.778405364@linuxfoundation.org>

4.9-stable review patch.  If anyone has any objections, please let me know.

------------------

From: WANG Cong <xiyou.wangcong@gmail.com>


[ Upstream commit 2f460933f58eee3393aba64f0f6d14acb08d1724 ]

Andrey reported a crash on init_net.ipv6.ip6_null_entry->rt6i_idev
since it is always NULL.

This is clearly wrong, we have code to initialize it to loopback_dev,
unfortunately the order is still not correct.

loopback_dev is registered very early during boot, we lose a chance
to re-initialize it in notifier. addrconf_init() is called after
ip6_route_init(), which means we have no chance to correct it.

Fix it by moving this initialization explicitly after
ipv6_add_dev(init_net.loopback_dev) in addrconf_init().

Reported-by: Andrey Konovalov <andreyknvl@google.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Tested-by: Andrey Konovalov <andreyknvl@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 include/net/ip6_route.h |    1 +
 net/ipv6/addrconf.c     |    2 ++
 net/ipv6/route.c        |   26 +++++++++++++++-----------
 3 files changed, 18 insertions(+), 11 deletions(-)

--- a/include/net/ip6_route.h
+++ b/include/net/ip6_route.h
@@ -84,6 +84,7 @@ struct dst_entry *ip6_route_lookup(struc
 struct rt6_info *ip6_pol_route(struct net *net, struct fib6_table *table,
 			       int ifindex, struct flowi6 *fl6, int flags);
 
+void ip6_route_init_special_entries(void);
 int ip6_route_init(void);
 void ip6_route_cleanup(void);
 
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -6264,6 +6264,8 @@ int __init addrconf_init(void)
 		goto errlo;
 	}
 
+	ip6_route_init_special_entries();
+
 	for (i = 0; i < IN6_ADDR_HSIZE; i++)
 		INIT_HLIST_HEAD(&inet6_addr_lst[i]);
 
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -3798,6 +3798,21 @@ static struct notifier_block ip6_route_d
 	.priority = 0,
 };
 
+void __init ip6_route_init_special_entries(void)
+{
+	/* Registering of the loopback is done before this portion of code,
+	 * the loopback reference in rt6_info will not be taken, do it
+	 * manually for init_net */
+	init_net.ipv6.ip6_null_entry->dst.dev = init_net.loopback_dev;
+	init_net.ipv6.ip6_null_entry->rt6i_idev = in6_dev_get(init_net.loopback_dev);
+  #ifdef CONFIG_IPV6_MULTIPLE_TABLES
+	init_net.ipv6.ip6_prohibit_entry->dst.dev = init_net.loopback_dev;
+	init_net.ipv6.ip6_prohibit_entry->rt6i_idev = in6_dev_get(init_net.loopback_dev);
+	init_net.ipv6.ip6_blk_hole_entry->dst.dev = init_net.loopback_dev;
+	init_net.ipv6.ip6_blk_hole_entry->rt6i_idev = in6_dev_get(init_net.loopback_dev);
+  #endif
+}
+
 int __init ip6_route_init(void)
 {
 	int ret;
@@ -3824,17 +3839,6 @@ int __init ip6_route_init(void)
 
 	ip6_dst_blackhole_ops.kmem_cachep = ip6_dst_ops_template.kmem_cachep;
 
-	/* Registering of the loopback is done before this portion of code,
-	 * the loopback reference in rt6_info will not be taken, do it
-	 * manually for init_net */
-	init_net.ipv6.ip6_null_entry->dst.dev = init_net.loopback_dev;
-	init_net.ipv6.ip6_null_entry->rt6i_idev = in6_dev_get(init_net.loopback_dev);
-  #ifdef CONFIG_IPV6_MULTIPLE_TABLES
-	init_net.ipv6.ip6_prohibit_entry->dst.dev = init_net.loopback_dev;
-	init_net.ipv6.ip6_prohibit_entry->rt6i_idev = in6_dev_get(init_net.loopback_dev);
-	init_net.ipv6.ip6_blk_hole_entry->dst.dev = init_net.loopback_dev;
-	init_net.ipv6.ip6_blk_hole_entry->rt6i_idev = in6_dev_get(init_net.loopback_dev);
-  #endif
 	ret = fib6_init();
 	if (ret)
 		goto out_register_subsys;

  parent reply	other threads:[~2017-05-11 14:13 UTC|newest]

Thread overview: 98+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-11 14:11 [PATCH 4.9 000/103] 4.9.28-stable review Greg Kroah-Hartman
2017-05-11 14:11 ` [PATCH 4.9 001/103] 9p: fix a potential acl leak Greg Kroah-Hartman
2017-05-11 14:11 ` [PATCH 4.9 002/103] drm/sti: fix GDP size to support up to UHD resolution Greg Kroah-Hartman
2017-05-11 14:11 ` [PATCH 4.9 003/103] hwmon: (it87) Fix pwm4 detection for IT8620 and IT8628 Greg Kroah-Hartman
2017-05-11 14:11 ` [PATCH 4.9 004/103] tpm: fix RC value check in tpm2_seal_trusted Greg Kroah-Hartman
2017-05-11 14:11 ` [PATCH 4.9 005/103] tmp: use pdev for parent device in tpm_chip_alloc Greg Kroah-Hartman
2017-05-11 14:11 ` [PATCH 4.9 008/103] cpupower: Fix turbo frequency reporting for pre-Sandy Bridge cores Greg Kroah-Hartman
2017-05-11 14:11 ` [PATCH 4.9 009/103] powerpc/mm: Fixup wrong LPCR_VRMASD value Greg Kroah-Hartman
2017-05-11 14:11 ` [PATCH 4.9 010/103] powerpc/powernv: Fix opal_exit tracepoint opcode Greg Kroah-Hartman
2017-05-11 14:11 ` [PATCH 4.9 011/103] powerpc/ftrace: Fix confusing help text for DISABLE_MPROFILE_KERNEL Greg Kroah-Hartman
2017-05-11 14:11 ` [PATCH 4.9 012/103] powerpc: Correctly disable latent entropy GCC plugin on prom_init.o Greg Kroah-Hartman
2017-05-11 14:11 ` [PATCH 4.9 013/103] perf/x86/intel/pt: Add format strings for PTWRITE and power event tracing Greg Kroah-Hartman
2017-05-11 14:11 ` [PATCH 4.9 014/103] power: supply: bq24190_charger: Fix irq trigger to IRQF_TRIGGER_FALLING Greg Kroah-Hartman
2017-05-11 14:11 ` [PATCH 4.9 015/103] power: supply: bq24190_charger: Call set_mode_host() on pm_resume() Greg Kroah-Hartman
2017-05-11 14:11 ` [PATCH 4.9 016/103] power: supply: bq24190_charger: Install irq_handler_thread() at end of probe() Greg Kroah-Hartman
2017-05-11 14:11 ` [PATCH 4.9 017/103] power: supply: bq24190_charger: Call power_supply_changed() for relevant component Greg Kroah-Hartman
2017-05-11 14:11 ` [PATCH 4.9 018/103] power: supply: bq24190_charger: Dont read fault register outside irq_handle_thread() Greg Kroah-Hartman
2017-05-11 14:11 ` [PATCH 4.9 019/103] power: supply: bq24190_charger: Handle fault before status on interrupt Greg Kroah-Hartman
2017-05-11 14:11 ` [PATCH 4.9 020/103] arm64: dts: r8a7795: Mark EthernetAVB device node disabled Greg Kroah-Hartman
2017-05-11 14:11 ` [PATCH 4.9 021/103] arm: dts: qcom: Fix ipq board clock rates Greg Kroah-Hartman
2017-05-11 14:11 ` [PATCH 4.9 022/103] arm64: Improve detection of user/non-user mappings in set_pte(_at) Greg Kroah-Hartman
2017-05-11 14:11 ` [PATCH 4.9 023/103] leds: ktd2692: avoid harmless maybe-uninitialized warning Greg Kroah-Hartman
2017-05-11 14:11 ` [PATCH 4.9 024/103] ARM: dts: NSP: GPIO reboot open-source Greg Kroah-Hartman
2017-05-11 14:11 ` [PATCH 4.9 025/103] ARM: OMAP5 / DRA7: Fix HYP mode boot for thumb2 build Greg Kroah-Hartman
2017-05-11 14:11 ` [PATCH 4.9 026/103] ARM: dts: sun7i: lamobo-r1: Fix CPU port RGMII settings Greg Kroah-Hartman
2017-05-11 14:11 ` [PATCH 4.9 027/103] mwifiex: debugfs: Fix (sometimes) off-by-1 SSID print Greg Kroah-Hartman
2017-05-11 14:11 ` [PATCH 4.9 028/103] mwifiex: remove redundant dma padding in AMSDU Greg Kroah-Hartman
2017-05-11 14:11 ` [PATCH 4.9 029/103] mwifiex: Avoid skipping WEP key deletion for AP Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 031/103] iwlwifi: mvm: dont restart HW if suspend fails with unified image Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 032/103] iwlwifi: mvm: overwrite skb info later Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 033/103] iwlwifi: pcie: dont increment / decrement a bool Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 035/103] iwlwifi: pcie: fix the set of DMA memory mask Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 036/103] iwlwifi: mvm: fix reorder timer re-arming Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 037/103] iwlwifi: mvm: Use aux queue for offchannel frames in dqa Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 038/103] iwlwifi: mvm/pcie: adjust A-MSDU tx_cmd length in PCIe Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 039/103] iwlwifi: mvm: fix pending frame counter calculation Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 040/103] iwlwifi: mvm: fix references to first_agg_queue in DQA mode Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 041/103] iwlwifi: mvm: synchronize firmware DMA paging memory Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 042/103] iwlwifi: mvm: writing zero bytes to debugfs causes a crash Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 043/103] x86/ioapic: Restore IO-APIC irq_chip retrigger callback Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 045/103] x86/mpx: Re-add MPX to selftests Makefile Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 046/103] clk: Make x86/ conditional on CONFIG_COMMON_CLK Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 047/103] kprobes/x86: Fix kernel panic when certain exception-handling addresses are probed Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 048/103] x86/platform/intel-mid: Correct MSI IRQ line for watchdog device Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 052/103] usb: dwc2: host: use msleep() for long delay Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 053/103] usb: host: ehci-exynos: Decrese node refcount on exynos_ehci_get_phy() error paths Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 054/103] usb: host: ohci-exynos: " Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 055/103] usb: chipidea: Only read/write OTGSC from one place Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 056/103] usb: chipidea: Handle extcon events properly Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 057/103] USB: serial: keyspan_pda: fix receive sanity checks Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 058/103] USB: serial: digi_acceleport: fix incomplete rx sanity check Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 059/103] USB: serial: ssu100: fix control-message error handling Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 060/103] USB: serial: io_edgeport: fix epic-descriptor handling Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 061/103] USB: serial: ti_usb_3410_5052: fix control-message error handling Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 062/103] USB: serial: ark3116: fix open " Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 063/103] USB: serial: ftdi_sio: fix latency-timer " Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 064/103] USB: serial: quatech2: fix control-message " Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 065/103] USB: serial: mct_u232: fix modem-status " Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 066/103] USB: serial: io_edgeport: fix descriptor " Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 067/103] USB: serial: sierra: fix bogus alternate-setting assumption Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 068/103] clk: rockchip: add "," to mux_pll_src_apll_dpll_gpll_usb480m_p on rk3036 Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 069/103] phy: qcom-usb-hs: Add depends on EXTCON Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 070/103] serial: 8250_omap: Fix probe and remove for PM runtime Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 071/103] scsi: qla2xxx: Fix crash in qla2xxx_eh_abort on bad ptr Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 072/103] scsi: mac_scsi: Fix MAC_SCSI=m option when SCSI=m Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 073/103] scsi: scsi_dh_emc: return success in clariion_std_inquiry() Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 074/103] scsi: smartpqi: fix time handling Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 075/103] MIPS: R2-on-R6 MULTU/MADDU/MSUBU emulation bugfix Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 076/103] brcmfmac: Ensure pointer correctly set if skb data location changes Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 077/103] brcmfmac: Make skb header writable before use Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 078/103] staging/lustre/llite: move root_squash from sysfs to debugfs Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 079/103] staging: wlan-ng: add missing byte order conversion Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 080/103] staging: emxx_udc: remove incorrect __init annotations Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 081/103] ALSA: hda - Fix deadlock of controller device lock at unbinding Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 082/103] sparc64: fix fault handling in NGbzero.S and GENbzero.S Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 083/103] macsec: dynamically allocate space for sglist Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 084/103] tcp: do not underestimate skb->truesize in tcp_trim_head() Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 085/103] bpf: enhance verifier to understand stack pointer arithmetic Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 086/103] bpf, arm64: fix jit branch offset related to ldimm64 Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 087/103] tcp: fix wraparound issue in tcp_lp Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 088/103] net: ipv6: Do not duplicate DAD on link up Greg Kroah-Hartman
2017-05-11 14:12 ` [PATCH 4.9 090/103] tcp: do not inherit fastopen_req from parent Greg Kroah-Hartman
2017-05-11 14:13 ` [PATCH 4.9 091/103] ipv4, ipv6: ensure raw socket message is big enough to hold an IP header Greg Kroah-Hartman
2017-05-11 14:13 ` [PATCH 4.9 092/103] rtnetlink: NUL-terminate IFLA_PHYS_PORT_NAME string Greg Kroah-Hartman
2017-05-11 14:13 ` Greg Kroah-Hartman [this message]
2017-05-11 14:13 ` [PATCH 4.9 094/103] ipv6: reorder ip6_route_dev_notifier after ipv6_dev_notf Greg Kroah-Hartman
2017-05-11 14:13 ` [PATCH 4.9 095/103] bnxt_en: allocate enough space for ->ntp_fltr_bmap Greg Kroah-Hartman
2017-05-11 14:13 ` [PATCH 4.9 096/103] bpf: dont let ldimm64 leak map addresses on unprivileged Greg Kroah-Hartman
2017-05-11 14:13 ` [PATCH 4.9 097/103] net: mdio-mux: bcm-iproc: call mdiobus_free() in error path Greg Kroah-Hartman
2017-05-11 14:13 ` [PATCH 4.9 098/103] f2fs: sanity check segment count Greg Kroah-Hartman
2017-05-11 14:13 ` [PATCH 4.9 099/103] xen: Revert commits da72ff5bfcb0 and 72a9b186292d Greg Kroah-Hartman
2017-05-11 14:13 ` [PATCH 4.9 100/103] wlcore: Pass win_size taken from ieee80211_sta to FW Greg Kroah-Hartman
2017-05-11 14:13 ` [PATCH 4.9 101/103] wlcore: Add RX_BA_WIN_SIZE_CHANGE_EVENT event Greg Kroah-Hartman
2017-05-11 14:13 ` [PATCH 4.9 103/103] block: get rid of blk_integrity_revalidate() Greg Kroah-Hartman
2017-05-11 21:09 ` [PATCH 4.9 000/103] 4.9.28-stable review Guenter Roeck
2017-05-12  6:20   ` Greg Kroah-Hartman
2017-05-12 15:24 ` Shuah Khan
2017-05-13  2:47 ` Guenter Roeck

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=20170511141217.759134446@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=andreyknvl@google.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=xiyou.wangcong@gmail.com \
    /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).