linux-kernel.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, Chris Novakovic <chris@chrisn.me.uk>,
	"David S. Miller" <davem@davemloft.net>,
	Sasha Levin <alexander.levin@microsoft.com>
Subject: [PATCH 4.4 084/124] ipconfig: Correctly initialise ic_nameservers
Date: Sat,  4 Aug 2018 11:01:13 +0200	[thread overview]
Message-ID: <20180804082705.639383479@linuxfoundation.org> (raw)
In-Reply-To: <20180804082702.434482435@linuxfoundation.org>

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

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

From: Chris Novakovic <chris@chrisn.me.uk>

[ Upstream commit 300eec7c0a2495f771709c7642aa15f7cc148b83 ]

ic_nameservers, which stores the list of name servers discovered by
ipconfig, is initialised (i.e. has all of its elements set to NONE, or
0xffffffff) by ic_nameservers_predef() in the following scenarios:

 - before the "ip=" and "nfsaddrs=" kernel command line parameters are
   parsed (in ip_auto_config_setup());
 - before autoconfiguring via DHCP or BOOTP (in ic_bootp_init()), in
   order to clear any values that may have been set after parsing "ip="
   or "nfsaddrs=" and are no longer needed.

This means that ic_nameservers_predef() is not called when neither "ip="
nor "nfsaddrs=" is specified on the kernel command line. In this
scenario, every element in ic_nameservers remains set to 0x00000000,
which is indistinguishable from ANY and causes pnp_seq_show() to write
the following (bogus) information to /proc/net/pnp:

  #MANUAL
  nameserver 0.0.0.0
  nameserver 0.0.0.0
  nameserver 0.0.0.0

This is potentially problematic for systems that blindly link
/etc/resolv.conf to /proc/net/pnp.

Ensure that ic_nameservers is also initialised when neither "ip=" nor
"nfsaddrs=" are specified by calling ic_nameservers_predef() in
ip_auto_config(), but only when ip_auto_config_setup() was not called
earlier. This causes the following to be written to /proc/net/pnp, and
is consistent with what gets written when ipconfig is configured
manually but no name servers are specified on the kernel command line:

  #MANUAL

Signed-off-by: Chris Novakovic <chris@chrisn.me.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 net/ipv4/ipconfig.c |   13 +++++++++++++
 1 file changed, 13 insertions(+)

--- a/net/ipv4/ipconfig.c
+++ b/net/ipv4/ipconfig.c
@@ -790,6 +790,11 @@ static void __init ic_bootp_init_ext(u8
  */
 static inline void __init ic_bootp_init(void)
 {
+	/* Re-initialise all name servers to NONE, in case any were set via the
+	 * "ip=" or "nfsaddrs=" kernel command line parameters: any IP addresses
+	 * specified there will already have been decoded but are no longer
+	 * needed
+	 */
 	ic_nameservers_predef();
 
 	dev_add_pack(&bootp_packet_type);
@@ -1423,6 +1428,13 @@ static int __init ip_auto_config(void)
 	int err;
 	unsigned int i;
 
+	/* Initialise all name servers to NONE (but only if the "ip=" or
+	 * "nfsaddrs=" kernel command line parameters weren't decoded, otherwise
+	 * we'll overwrite the IP addresses specified there)
+	 */
+	if (ic_set_manually == 0)
+		ic_nameservers_predef();
+
 #ifdef CONFIG_PROC_FS
 	proc_create("pnp", S_IRUGO, init_net.proc_net, &pnp_seq_fops);
 #endif /* CONFIG_PROC_FS */
@@ -1640,6 +1652,7 @@ static int __init ip_auto_config_setup(c
 		return 1;
 	}
 
+	/* Initialise all name servers to NONE */
 	ic_nameservers_predef();
 
 	/* Parse string for static IP assignment.  */



  parent reply	other threads:[~2018-08-04  9:10 UTC|newest]

Thread overview: 144+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-04  8:59 [PATCH 4.4 000/124] 4.4.146-stable review Greg Kroah-Hartman
2018-08-04  8:59 ` [PATCH 4.4 001/124] MIPS: Fix off-by-one in pci_resource_to_user() Greg Kroah-Hartman
2018-08-04  8:59 ` [PATCH 4.4 002/124] Input: elan_i2c - add ACPI ID for lenovo ideapad 330 Greg Kroah-Hartman
2018-08-04  8:59 ` [PATCH 4.4 003/124] Input: i8042 - add Lenovo LaVie Z to the i8042 reset list Greg Kroah-Hartman
2018-08-04  8:59 ` [PATCH 4.4 004/124] Input: elan_i2c - add another ACPI ID for Lenovo Ideapad 330-15AST Greg Kroah-Hartman
2018-08-04  8:59 ` [PATCH 4.4 005/124] tracing: Fix double free of event_trigger_data Greg Kroah-Hartman
2018-08-04  8:59 ` [PATCH 4.4 006/124] tracing: Fix possible double free in event_enable_trigger_func() Greg Kroah-Hartman
2018-08-04  8:59 ` [PATCH 4.4 007/124] tracing/kprobes: Fix trace_probe flags on enable_trace_kprobe() failure Greg Kroah-Hartman
2018-08-04  8:59 ` [PATCH 4.4 008/124] tracing: Quiet gcc warning about maybe unused link variable Greg Kroah-Hartman
2018-08-04  8:59 ` [PATCH 4.4 009/124] xen/netfront: raise max number of slots in xennet_get_responses() Greg Kroah-Hartman
2018-08-04  8:59 ` [PATCH 4.4 010/124] ALSA: emu10k1: add error handling for snd_ctl_add Greg Kroah-Hartman
2018-08-04  9:00 ` [PATCH 4.4 011/124] ALSA: fm801: " Greg Kroah-Hartman
2018-08-04  9:00 ` [PATCH 4.4 012/124] nfsd: fix potential use-after-free in nfsd4_decode_getdeviceinfo Greg Kroah-Hartman
2018-08-04  9:00 ` [PATCH 4.4 013/124] mm: vmalloc: avoid racy handling of debugobjects in vunmap Greg Kroah-Hartman
2018-08-04  9:00 ` [PATCH 4.4 014/124] mm/slub.c: add __printf verification to slab_err() Greg Kroah-Hartman
2018-08-04  9:00 ` [PATCH 4.4 015/124] rtc: ensure rtc_set_alarm fails when alarms are not supported Greg Kroah-Hartman
2018-08-04  9:00 ` [PATCH 4.4 016/124] netfilter: ipset: List timing out entries with "timeout 1" instead of zero Greg Kroah-Hartman
2018-08-04  9:00 ` [PATCH 4.4 017/124] infiniband: fix a possible use-after-free bug Greg Kroah-Hartman
2018-08-04  9:00 ` [PATCH 4.4 018/124] hvc_opal: dont set tb_ticks_per_usec in udbg_init_opal_common() Greg Kroah-Hartman
2018-08-04  9:00 ` [PATCH 4.4 019/124] powerpc/64s: Fix compiler store ordering to SLB shadow area Greg Kroah-Hartman
2018-08-04  9:00 ` [PATCH 4.4 020/124] RDMA/mad: Convert BUG_ONs to error flows Greg Kroah-Hartman
2018-08-04  9:00 ` [PATCH 4.4 021/124] disable loading f2fs module on PAGE_SIZE > 4KB Greg Kroah-Hartman
2018-08-04  9:00 ` [PATCH 4.4 022/124] f2fs: fix to dont trigger writeback during recovery Greg Kroah-Hartman
2018-08-04  9:00 ` [PATCH 4.4 023/124] usbip: usbip_detach: Fix memory, udev context and udev leak Greg Kroah-Hartman
2018-08-04  9:00 ` [PATCH 4.4 024/124] perf/x86/intel/uncore: Correct fixed counter index check in generic code Greg Kroah-Hartman
2018-08-04  9:00 ` [PATCH 4.4 025/124] perf/x86/intel/uncore: Correct fixed counter index check for NHM Greg Kroah-Hartman
2018-08-04  9:00 ` [PATCH 4.4 026/124] iwlwifi: pcie: fix race in Rx buffer allocator Greg Kroah-Hartman
2018-09-05 18:39   ` Ben Hutchings
2018-08-04  9:00 ` [PATCH 4.4 027/124] Bluetooth: hci_qca: Fix "Sleep inside atomic section" warning Greg Kroah-Hartman
2018-08-04  9:00 ` [PATCH 4.4 028/124] Bluetooth: btusb: Add a new Realtek 8723DE ID 2ff8:b011 Greg Kroah-Hartman
2018-08-04  9:00 ` [PATCH 4.4 029/124] ASoC: dpcm: fix BE dai not hw_free and shutdown Greg Kroah-Hartman
2018-08-04  9:00 ` [PATCH 4.4 030/124] mfd: cros_ec: Fail early if we cannot identify the EC Greg Kroah-Hartman
2018-08-04  9:00 ` [PATCH 4.4 031/124] mwifiex: handle race during mwifiex_usb_disconnect Greg Kroah-Hartman
2018-08-04  9:00 ` [PATCH 4.4 032/124] wlcore: sdio: check for valid platform device data before suspend Greg Kroah-Hartman
2018-08-04  9:00 ` [PATCH 4.4 033/124] media: videobuf2-core: dont call memop finish when queueing Greg Kroah-Hartman
2018-08-04  9:00 ` [PATCH 4.4 034/124] btrfs: add barriers to btrfs_sync_log before log_commit_wait wakeups Greg Kroah-Hartman
2018-08-04  9:00 ` [PATCH 4.4 035/124] btrfs: qgroup: Finish rescan when hit the last leaf of extent tree Greg Kroah-Hartman
2018-08-04  9:00 ` [PATCH 4.4 036/124] PCI: Prevent sysfs disable of device while driver is attached Greg Kroah-Hartman
2018-08-04  9:00 ` [PATCH 4.4 037/124] ath: Add regulatory mapping for FCC3_ETSIC Greg Kroah-Hartman
2018-08-04  9:00 ` [PATCH 4.4 038/124] ath: Add regulatory mapping for ETSI8_WORLD Greg Kroah-Hartman
2018-08-04  9:00 ` [PATCH 4.4 039/124] ath: Add regulatory mapping for APL13_WORLD Greg Kroah-Hartman
2018-08-04  9:00 ` [PATCH 4.4 040/124] ath: Add regulatory mapping for APL2_FCCA Greg Kroah-Hartman
2018-08-04  9:00 ` [PATCH 4.4 041/124] ath: Add regulatory mapping for Uganda Greg Kroah-Hartman
2018-08-04  9:00 ` [PATCH 4.4 042/124] ath: Add regulatory mapping for Tanzania Greg Kroah-Hartman
2018-08-04  9:00 ` [PATCH 4.4 043/124] ath: Add regulatory mapping for Serbia Greg Kroah-Hartman
2018-08-04  9:00 ` [PATCH 4.4 044/124] ath: Add regulatory mapping for Bermuda Greg Kroah-Hartman
2018-08-04  9:00 ` [PATCH 4.4 045/124] ath: Add regulatory mapping for Bahamas Greg Kroah-Hartman
2018-08-04  9:00 ` [PATCH 4.4 050/124] powerpc/8xx: fix invalid register expression in head_8xx.S Greg Kroah-Hartman
2018-08-04  9:00 ` [PATCH 4.4 051/124] pinctrl: at91-pio4: add missing of_node_put Greg Kroah-Hartman
2018-08-04  9:00 ` [PATCH 4.4 052/124] PCI: pciehp: Request control of native hotplug only if supported Greg Kroah-Hartman
2018-08-04  9:00 ` [PATCH 4.4 053/124] mwifiex: correct histogram data with appropriate index Greg Kroah-Hartman
2018-08-04  9:00 ` [PATCH 4.4 054/124] scsi: ufs: fix exception event handling Greg Kroah-Hartman
2018-09-05 19:11   ` Ben Hutchings
2018-08-04  9:00 ` [PATCH 4.4 055/124] ALSA: emu10k1: Rate-limit error messages about page errors Greg Kroah-Hartman
2018-08-04  9:00 ` [PATCH 4.4 056/124] regulator: pfuze100: add .is_enable() for pfuze100_swb_regulator_ops Greg Kroah-Hartman
2018-08-04  9:00 ` [PATCH 4.4 057/124] md: fix NULL dereference of mddev->pers in remove_and_add_spares() Greg Kroah-Hartman
2018-08-04  9:00 ` [PATCH 4.4 058/124] media: smiapp: fix timeout checking in smiapp_read_nvm Greg Kroah-Hartman
2018-08-04  9:00 ` [PATCH 4.4 059/124] ALSA: usb-audio: Apply rate limit to warning messages in URB complete callback Greg Kroah-Hartman
2018-08-04  9:00 ` [PATCH 4.4 060/124] HID: hid-plantronics: Re-resend Update to map button for PTT products Greg Kroah-Hartman
2018-08-04  9:00 ` [PATCH 4.4 061/124] drm/radeon: fix mode_valids return type Greg Kroah-Hartman
2018-08-04  9:00 ` [PATCH 4.4 063/124] HID: i2c-hid: check if device is there before really probing Greg Kroah-Hartman
2018-08-04  9:00 ` [PATCH 4.4 064/124] tty: Fix data race in tty_insert_flip_string_fixed_flag Greg Kroah-Hartman
2018-08-04  9:00 ` [PATCH 4.4 066/124] media: rcar_jpu: Add missing clk_disable_unprepare() on error in jpu_open() Greg Kroah-Hartman
2018-08-04  9:00 ` [PATCH 4.4 067/124] libata: Fix command retry decision Greg Kroah-Hartman
2018-08-04  9:00 ` [PATCH 4.4 068/124] media: saa7164: Fix driver name in debug output Greg Kroah-Hartman
2018-08-04  9:00 ` [PATCH 4.4 069/124] mtd: rawnand: fsl_ifc: fix FSL NAND driver to read all ONFI parameter pages Greg Kroah-Hartman
2018-08-04  9:00 ` [PATCH 4.4 070/124] brcmfmac: Add support for bcm43364 wireless chipset Greg Kroah-Hartman
2018-08-04  9:01 ` [PATCH 4.4 071/124] s390/cpum_sf: Add data entry sizes to sampling trailer entry Greg Kroah-Hartman
2018-08-04  9:01 ` [PATCH 4.4 072/124] perf: fix invalid bit in diagnostic entry Greg Kroah-Hartman
2018-08-04  9:01 ` [PATCH 4.4 073/124] scsi: 3w-9xxx: fix a missing-check bug Greg Kroah-Hartman
2018-08-04  9:01 ` [PATCH 4.4 074/124] scsi: 3w-xxxx: " Greg Kroah-Hartman
2018-08-04  9:01 ` [PATCH 4.4 075/124] scsi: megaraid: silence a static checker bug Greg Kroah-Hartman
2018-08-04  9:01 ` [PATCH 4.4 076/124] thermal: exynos: fix setting rising_threshold for Exynos5433 Greg Kroah-Hartman
2018-08-04  9:01 ` [PATCH 4.4 077/124] bpf: fix references to free_bpf_prog_info() in comments Greg Kroah-Hartman
2018-08-04  9:01 ` [PATCH 4.4 078/124] media: siano: get rid of __le32/__le16 cast warnings Greg Kroah-Hartman
2018-08-04  9:01 ` [PATCH 4.4 079/124] drm/atomic: Handling the case when setting old crtc for plane Greg Kroah-Hartman
2018-08-04  9:01 ` [PATCH 4.4 080/124] ALSA: hda/ca0132: fix build failure when a local macro is defined Greg Kroah-Hartman
2018-08-04  9:01 ` [PATCH 4.4 081/124] memory: tegra: Do not handle spurious interrupts Greg Kroah-Hartman
2018-08-04  9:01 ` [PATCH 4.4 082/124] memory: tegra: Apply interrupts mask per SoC Greg Kroah-Hartman
2018-08-04  9:01 ` [PATCH 4.4 083/124] drm/gma500: fix psb_intel_lvds_mode_valid()s return type Greg Kroah-Hartman
2018-08-04  9:01 ` Greg Kroah-Hartman [this message]
2018-08-04  9:01 ` [PATCH 4.4 085/124] rsi: Fix invalid vdd warning in mmc Greg Kroah-Hartman
2018-08-04  9:01 ` [PATCH 4.4 087/124] microblaze: Fix simpleImage format generation Greg Kroah-Hartman
2018-08-04  9:01 ` [PATCH 4.4 088/124] usb: hub: Dont wait for connect state at resume for powered-off ports Greg Kroah-Hartman
2018-08-04  9:01 ` [PATCH 4.4 089/124] crypto: authencesn - dont leak pointers to authenc keys Greg Kroah-Hartman
2018-08-04  9:01 ` [PATCH 4.4 090/124] crypto: authenc " Greg Kroah-Hartman
2018-08-04  9:01 ` [PATCH 4.4 091/124] media: omap3isp: fix unbalanced dma_iommu_mapping Greg Kroah-Hartman
2018-08-04  9:01 ` [PATCH 4.4 092/124] scsi: scsi_dh: replace too broad "TP9" string with the exact models Greg Kroah-Hartman
2018-08-04  9:01 ` [PATCH 4.4 093/124] scsi: megaraid_sas: Increase timeout by 1 sec for non-RAID fastpath IOs Greg Kroah-Hartman
2018-08-04  9:01 ` [PATCH 4.4 094/124] media: si470x: fix __be16 annotations Greg Kroah-Hartman
2018-08-04  9:01 ` [PATCH 4.4 096/124] random: mix rdrand with entropy sent in from userspace Greg Kroah-Hartman
2018-08-04  9:01 ` [PATCH 4.4 097/124] squashfs: be more careful about metadata corruption Greg Kroah-Hartman
2018-08-04  9:01 ` [PATCH 4.4 098/124] ext4: fix inline data updates with checksums enabled Greg Kroah-Hartman
2018-08-04  9:01 ` [PATCH 4.4 099/124] ext4: check for allocation block validity with block group locked Greg Kroah-Hartman
2018-08-04  9:01 ` [PATCH 4.4 100/124] dmaengine: pxa_dma: remove duplicate const qualifier Greg Kroah-Hartman
2018-08-04  9:01 ` [PATCH 4.4 101/124] ASoC: pxa: Fix module autoload for platform drivers Greg Kroah-Hartman
2018-08-04  9:01 ` [PATCH 4.4 102/124] ipv4: remove BUG_ON() from fib_compute_spec_dst Greg Kroah-Hartman
2018-08-04  9:01 ` [PATCH 4.4 103/124] net: fix amd-xgbe flow-control issue Greg Kroah-Hartman
2018-08-04  9:01 ` [PATCH 4.4 104/124] net: lan78xx: fix rx handling before first packet is send Greg Kroah-Hartman
2018-08-04  9:01 ` [PATCH 4.4 105/124] xen-netfront: wait xenbus state change when load module manually Greg Kroah-Hartman
2018-09-07  0:21   ` Ben Hutchings
2018-09-07 17:27     ` Boris Ostrovsky
2018-09-11 18:16       ` Ben Hutchings
2018-08-04  9:01 ` [PATCH 4.4 106/124] netlink: Do not subscribe to non-existent groups Greg Kroah-Hartman
2018-08-04 18:07   ` Nathan Chancellor
2018-08-04 22:33     ` Dmitry Safonov
2018-08-04 22:49       ` Nathan Chancellor
2018-08-04 23:12         ` Dmitry Safonov
2018-08-04 23:21           ` Nathan Chancellor
2018-08-04 23:25             ` David Miller
2018-08-04 23:26             ` Dmitry Safonov
2018-08-04 23:33               ` David Miller
2018-08-04 23:44                 ` Dmitry Safonov
2018-08-04 23:50                   ` Dmitry Safonov
2018-08-05  0:07                   ` David Miller
2018-08-04 23:47                 ` Dmitry Safonov
2018-08-05  0:08                   ` David Miller
2018-08-05 14:03     ` Greg Kroah-Hartman
2018-08-04  9:01 ` [PATCH 4.4 107/124] netlink: Dont shift with UB on nlk->ngroups Greg Kroah-Hartman
2018-08-04  9:01 ` [PATCH 4.4 108/124] NET: stmmac: align DMA stuff to largest cache line length Greg Kroah-Hartman
2018-08-04  9:01 ` [PATCH 4.4 109/124] tcp: do not force quickack when receiving out-of-order packets Greg Kroah-Hartman
2018-08-04  9:01 ` [PATCH 4.4 110/124] tcp: add max_quickacks param to tcp_incr_quickack and tcp_enter_quickack_mode Greg Kroah-Hartman
2018-08-04  9:01 ` [PATCH 4.4 111/124] tcp: do not aggressively quick ack after ECN events Greg Kroah-Hartman
2018-08-04  9:01 ` [PATCH 4.4 112/124] tcp: refactor tcp_ecn_check_ce to remove sk type cast Greg Kroah-Hartman
2018-08-04  9:01 ` [PATCH 4.4 113/124] tcp: add one more quick ack after after ECN events Greg Kroah-Hartman
2018-08-04  9:01 ` [PATCH 4.4 114/124] inet: frag: enforce memory limits earlier Greg Kroah-Hartman
2018-08-04  9:01 ` [PATCH 4.4 115/124] net: dsa: Do not suspend/resume closed slave_dev Greg Kroah-Hartman
2018-08-04  9:01 ` [PATCH 4.4 116/124] netlink: Fix spectre v1 gadget in netlink_create() Greg Kroah-Hartman
2018-08-04  9:01 ` [PATCH 4.4 117/124] squashfs: more metadata hardening Greg Kroah-Hartman
2018-08-04  9:01 ` [PATCH 4.4 119/124] can: ems_usb: Fix memory leak on ems_usb_disconnect() Greg Kroah-Hartman
2018-08-04  9:01 ` [PATCH 4.4 120/124] net: socket: fix potential spectre v1 gadget in socketcall Greg Kroah-Hartman
2018-08-04  9:01 ` [PATCH 4.4 121/124] virtio_balloon: fix another race between migration and ballooning Greg Kroah-Hartman
2018-08-04  9:01 ` [PATCH 4.4 122/124] kvm: x86: vmx: fix vpid leak Greg Kroah-Hartman
2018-08-04  9:01 ` [PATCH 4.4 123/124] crypto: padlock-aes - Fix Nano workaround data corruption Greg Kroah-Hartman
2018-09-07  1:54   ` Ben Hutchings
2018-08-04  9:01 ` [PATCH 4.4 124/124] scsi: sg: fix minor memory leak in error path Greg Kroah-Hartman
2018-08-04  9:29 ` [PATCH 4.4 000/124] 4.4.146-stable review Nathan Chancellor
2018-08-04 14:47 ` Guenter Roeck
2018-08-05 11:54 ` Naresh Kamboju
2018-08-05 13:49   ` Greg Kroah-Hartman
2018-08-05 14:41     ` Guenter Roeck
2018-08-05 15:19     ` Dan Rue
2018-08-06 15:35       ` Greg Kroah-Hartman
2018-08-08  0:00         ` Anmar Oueja

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=20180804082705.639383479@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=alexander.levin@microsoft.com \
    --cc=chris@chrisn.me.uk \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /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).