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,
	Nikolay Aleksandrov <nikolay@cumulusnetworks.com>,
	Ido Schimmel <idosch@mellanox.com>,
	"Peter V. Saveliev" <peter@svinota.eu>,
	"David S. Miller" <davem@davemloft.net>,
	Sasha Levin <alexander.levin@verizon.com>
Subject: [PATCH 4.9 066/104] bridge: netlink: register netdevice before executing changelink
Date: Fri,  6 Oct 2017 10:51:44 +0200	[thread overview]
Message-ID: <20171006083850.560478827@linuxfoundation.org> (raw)
In-Reply-To: <20171006083840.743659740@linuxfoundation.org>

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

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

From: Ido Schimmel <idosch@mellanox.com>


[ Upstream commit 5b8d5429daa05bebef6ffd3297df3b502cc6f184 ]

Peter reported a kernel oops when executing the following command:

$ ip link add name test type bridge vlan_default_pvid 1

[13634.939408] BUG: unable to handle kernel NULL pointer dereference at
0000000000000190
[13634.939436] IP: __vlan_add+0x73/0x5f0
[...]
[13634.939783] Call Trace:
[13634.939791]  ? pcpu_next_unpop+0x3b/0x50
[13634.939801]  ? pcpu_alloc+0x3d2/0x680
[13634.939810]  ? br_vlan_add+0x135/0x1b0
[13634.939820]  ? __br_vlan_set_default_pvid.part.28+0x204/0x2b0
[13634.939834]  ? br_changelink+0x120/0x4e0
[13634.939844]  ? br_dev_newlink+0x50/0x70
[13634.939854]  ? rtnl_newlink+0x5f5/0x8a0
[13634.939864]  ? rtnl_newlink+0x176/0x8a0
[13634.939874]  ? mem_cgroup_commit_charge+0x7c/0x4e0
[13634.939886]  ? rtnetlink_rcv_msg+0xe1/0x220
[13634.939896]  ? lookup_fast+0x52/0x370
[13634.939905]  ? rtnl_newlink+0x8a0/0x8a0
[13634.939915]  ? netlink_rcv_skb+0xa1/0xc0
[13634.939925]  ? rtnetlink_rcv+0x24/0x30
[13634.939934]  ? netlink_unicast+0x177/0x220
[13634.939944]  ? netlink_sendmsg+0x2fe/0x3b0
[13634.939954]  ? _copy_from_user+0x39/0x40
[13634.939964]  ? sock_sendmsg+0x30/0x40
[13634.940159]  ? ___sys_sendmsg+0x29d/0x2b0
[13634.940326]  ? __alloc_pages_nodemask+0xdf/0x230
[13634.940478]  ? mem_cgroup_commit_charge+0x7c/0x4e0
[13634.940592]  ? mem_cgroup_try_charge+0x76/0x1a0
[13634.940701]  ? __handle_mm_fault+0xdb9/0x10b0
[13634.940809]  ? __sys_sendmsg+0x51/0x90
[13634.940917]  ? entry_SYSCALL_64_fastpath+0x1e/0xad

The problem is that the bridge's VLAN group is created after setting the
default PVID, when registering the netdevice and executing its
ndo_init().

Fix this by changing the order of both operations, so that
br_changelink() is only processed after the netdevice is registered,
when the VLAN group is already initialized.

Fixes: b6677449dff6 ("bridge: netlink: call br_changelink() during br_dev_newlink()")
Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Reported-by: Peter V. Saveliev <peter@svinota.eu>
Tested-by: Peter V. Saveliev <peter@svinota.eu>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 net/bridge/br_netlink.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

--- a/net/bridge/br_netlink.c
+++ b/net/bridge/br_netlink.c
@@ -1098,11 +1098,14 @@ static int br_dev_newlink(struct net *sr
 		spin_unlock_bh(&br->lock);
 	}
 
-	err = br_changelink(dev, tb, data);
+	err = register_netdevice(dev);
 	if (err)
 		return err;
 
-	return register_netdevice(dev);
+	err = br_changelink(dev, tb, data);
+	if (err)
+		unregister_netdevice(dev);
+	return err;
 }
 
 static size_t br_get_size(const struct net_device *brdev)

  parent reply	other threads:[~2017-10-06  8:51 UTC|newest]

Thread overview: 143+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-06  8:50 [PATCH 4.9 000/104] 4.9.54-stable review Greg Kroah-Hartman
2017-10-06  8:50 ` [PATCH 4.9 001/104] drm_fourcc: Fix DRM_FORMAT_MOD_LINEAR #define Greg Kroah-Hartman
2017-10-06  8:50 ` [PATCH 4.9 002/104] drm: bridge: add DT bindings for TI ths8135 Greg Kroah-Hartman
2017-10-06  8:50 ` [PATCH 4.9 003/104] GFS2: Fix reference to ERR_PTR in gfs2_glock_iter_next Greg Kroah-Hartman
2017-10-06  8:50 ` [PATCH 4.9 005/104] ARM: dts: exynos: Add CPU OPPs for Exynos4412 Prime Greg Kroah-Hartman
2017-10-06  8:50 ` [PATCH 4.9 006/104] clk: sunxi-ng: fix PLL_CPUX adjusting on H3 Greg Kroah-Hartman
2017-10-06  8:50 ` [PATCH 4.9 007/104] RDS: RDMA: Fix the composite message user notification Greg Kroah-Hartman
2017-10-06  8:50 ` [PATCH 4.9 008/104] ARM: dts: r8a7790: Use R-Car Gen 2 fallback binding for msiof nodes Greg Kroah-Hartman
2017-10-06  8:50 ` [PATCH 4.9 009/104] MIPS: Ensure bss section ends on a long-aligned address Greg Kroah-Hartman
2017-10-06  8:50 ` [PATCH 4.9 010/104] MIPS: fix mem=X@Y commandline processing Greg Kroah-Hartman
2017-10-06  9:10   ` Mathieu Malaterre
2017-10-06  9:18     ` Greg Kroah-Hartman
2017-10-06  9:21       ` Mathieu Malaterre
2017-10-06  8:50 ` [PATCH 4.9 011/104] MIPS: kexec: Do not reserve invalid crashkernel memory on boot Greg Kroah-Hartman
2017-10-06  8:50 ` [PATCH 4.9 012/104] MIPS: ralink: Fix a typo in the pinmux setup Greg Kroah-Hartman
2017-10-06  8:50 ` [PATCH 4.9 013/104] MIPS: ralink: Fix incorrect assignment on ralink_soc Greg Kroah-Hartman
2017-10-06  8:50 ` [PATCH 4.9 014/104] power: supply: axp288_fuel_gauge: Fix fuel_gauge_reg_readb return on error Greg Kroah-Hartman
2017-10-06  8:50 ` [PATCH 4.9 015/104] scsi: be2iscsi: Add checks to validate CID alloc/free Greg Kroah-Hartman
2017-10-06  8:50 ` [PATCH 4.9 016/104] ARM: dts: am335x-chilisom: Wakeup from RTC-only state by power on event Greg Kroah-Hartman
2017-10-06  8:50 ` [PATCH 4.9 017/104] igb: re-assign hw address pointer on reset after PCI error Greg Kroah-Hartman
2017-10-06  8:50 ` [PATCH 4.9 018/104] extcon: axp288: Use vbus-valid instead of -present to determine cable presence Greg Kroah-Hartman
2017-10-06  8:50 ` [PATCH 4.9 019/104] reset: ti_syscon: fix a ti_syscon_reset_status issue Greg Kroah-Hartman
2017-10-06  8:50 ` [PATCH 4.9 021/104] clk/axs10x: Clear init field in driver probe Greg Kroah-Hartman
2017-10-06  8:51 ` [PATCH 4.9 022/104] usb: make the MTK XHCI driver compile for older MIPS SoCs Greg Kroah-Hartman
2017-10-06  8:51 ` [PATCH 4.9 023/104] hwmon: (gl520sm) Fix overflows and crash seen when writing into limit attributes Greg Kroah-Hartman
2017-10-06  8:51 ` [PATCH 4.9 024/104] iio: adc: imx25-gcq: Fix module autoload Greg Kroah-Hartman
2017-10-06  8:51 ` [PATCH 4.9 025/104] iio: adc: axp288: Drop bogus AXP288_ADC_TS_PIN_CTRL register modifications Greg Kroah-Hartman
2017-10-06  8:51 ` [PATCH 4.9 026/104] iio: adc: hx711: Add DT binding for avia,hx711 Greg Kroah-Hartman
2017-10-06  8:51 ` [PATCH 4.9 027/104] IB/rxe: Add a runtime check in alloc_index() Greg Kroah-Hartman
2017-10-06  8:51 ` [PATCH 4.9 028/104] IB/rxe: Fix a MR reference leak in check_rkey() Greg Kroah-Hartman
2017-10-06  8:51 ` [PATCH 4.9 029/104] ARM: 8635/1: nommu: allow enabling REMAP_VECTORS_TO_RAM Greg Kroah-Hartman
2017-10-06  8:51 ` [PATCH 4.9 030/104] drm/i915/psr: disable psr2 for resolution greater than 32X20 Greg Kroah-Hartman
2017-10-06  8:51 ` [PATCH 4.9 031/104] serial: 8250: moxa: Store num_ports in brd Greg Kroah-Hartman
2017-10-06  8:51 ` [PATCH 4.9 032/104] tty: goldfish: Fix a parameter of a call to free_irq Greg Kroah-Hartman
2017-10-06  8:51 ` [PATCH 4.9 033/104] serial: 8250_port: Remove dangerous pr_debug() Greg Kroah-Hartman
2017-10-06  8:51 ` [PATCH 4.9 034/104] IB/ipoib: Fix deadlock over vlan_mutex Greg Kroah-Hartman
2017-10-06  8:51 ` [PATCH 4.9 035/104] IB/ipoib: rtnl_unlock can not come after free_netdev Greg Kroah-Hartman
2017-10-06  8:51 ` [PATCH 4.9 036/104] IB/ipoib: Replace list_del of the neigh->list with list_del_init Greg Kroah-Hartman
2017-10-06  8:51 ` [PATCH 4.9 037/104] arm: dts: mt2701: Add subsystem clock controller device nodes Greg Kroah-Hartman
2017-10-06  8:51 ` [PATCH 4.9 038/104] drm/amdkfd: fix improper return value on error Greg Kroah-Hartman
2017-10-06  8:51 ` [PATCH 4.9 039/104] USB: serial: mos7720: fix control-message error handling Greg Kroah-Hartman
2017-10-06  8:51 ` [PATCH 4.9 040/104] USB: serial: mos7840: " Greg Kroah-Hartman
2017-10-06  8:51 ` [PATCH 4.9 041/104] sfc: get PIO buffer size from the NIC Greg Kroah-Hartman
2017-10-06  8:51 ` [PATCH 4.9 042/104] pinctrl: mvebu: Use seq_puts() in mvebu_pinconf_group_dbg_show() Greg Kroah-Hartman
2017-10-06  8:51 ` [PATCH 4.9 043/104] partitions/efi: Fix integer overflow in GPT size calculation Greg Kroah-Hartman
2017-10-06  8:51 ` [PATCH 4.9 044/104] ASoC: dapm: handle probe deferrals Greg Kroah-Hartman
2017-10-06  8:51 ` [PATCH 4.9 045/104] audit: log 32-bit socketcalls Greg Kroah-Hartman
2017-10-06  8:51 ` [PATCH 4.9 046/104] ath10k: prevent sta pointer rcu violation Greg Kroah-Hartman
2017-10-06  8:51 ` [PATCH 4.9 047/104] spi: pxa2xx: Add support for Intel Gemini Lake Greg Kroah-Hartman
2017-10-06  8:51 ` [PATCH 4.9 048/104] iommu/arm-smmu: Set privileged attribute to default instead of unprivileged Greg Kroah-Hartman
2017-10-06  8:51 ` [PATCH 4.9 049/104] usb: chipidea: vbus event may exist before starting gadget Greg Kroah-Hartman
2017-10-06  8:51 ` [PATCH 4.9 051/104] ASoC: dapm: fix some pointer error handling Greg Kroah-Hartman
2017-10-06  8:51 ` [PATCH 4.9 052/104] drm: mali-dp: Fix destination size handling when rotating Greg Kroah-Hartman
2017-10-06  8:51 ` [PATCH 4.9 053/104] drm: mali-dp: Fix transposed horizontal/vertical flip Greg Kroah-Hartman
2017-10-06  8:51 ` [PATCH 4.9 054/104] HID: wacom: release the resources before leaving despite devm Greg Kroah-Hartman
2017-10-06  8:51 ` [PATCH 4.9 055/104] MIPS: Lantiq: Fix another request_mem_region() return code check Greg Kroah-Hartman
2017-10-06  8:51 ` [PATCH 4.9 056/104] mips: ath79: clock:- Unmap region obtained by of_iomap Greg Kroah-Hartman
2017-10-06  8:51 ` [PATCH 4.9 057/104] lkdtm: Fix Oops when unloading the module Greg Kroah-Hartman
2017-10-06  8:51 ` [PATCH 4.9 058/104] net: core: Prevent from dereferencing null pointer when releasing SKB Greg Kroah-Hartman
2017-10-06  8:51 ` [PATCH 4.9 059/104] net/packet: check length in getsockopt() called with PACKET_HDRLEN Greg Kroah-Hartman
2017-10-06  8:51 ` [PATCH 4.9 060/104] team: fix memory leaks Greg Kroah-Hartman
2017-10-06  8:51 ` [PATCH 4.9 062/104] udp: disable inner UDP checksum offloads in IPsec case Greg Kroah-Hartman
2017-10-06  8:51 ` [PATCH 4.9 063/104] net: dsa: b53: Include IMP/CPU port in dumb forwarding mode Greg Kroah-Hartman
2017-10-06  8:51 ` [PATCH 4.9 064/104] qed: Fix possible system hang in the dcbnl-getdcbx() path Greg Kroah-Hartman
2017-10-06  8:51 ` [PATCH 4.9 065/104] mmc: sdio: fix alignment issue in struct sdio_func Greg Kroah-Hartman
2017-10-06  8:51 ` Greg Kroah-Hartman [this message]
2017-10-06  8:51 ` [PATCH 4.9 067/104] Btrfs: fix segmentation fault when doing dio read Greg Kroah-Hartman
2017-10-06  8:51 ` [PATCH 4.9 068/104] Btrfs: fix potential use-after-free for cloned bio Greg Kroah-Hartman
2017-10-06  8:51 ` [PATCH 4.9 069/104] sata_via: Enable hotplug only on VT6421 Greg Kroah-Hartman
2017-10-06  8:51 ` [PATCH 4.9 070/104] hugetlbfs: initialize shared policy as part of inode allocation Greg Kroah-Hartman
2017-10-06  8:51 ` [PATCH 4.9 071/104] kasan: do not sanitize kexec purgatory Greg Kroah-Hartman
2017-10-06  8:51 ` [PATCH 4.9 073/104] netfilter: invoke synchronize_rcu after set the _hook_ to NULL Greg Kroah-Hartman
2017-10-06  8:51 ` [PATCH 4.9 074/104] MIPS: IRQ Stack: Unwind IRQ stack onto task stack Greg Kroah-Hartman
2017-10-06  8:51 ` [PATCH 4.9 075/104] iommu/exynos: Block SYSMMU while invalidating FLPD cache Greg Kroah-Hartman
2017-10-06  8:51 ` [PATCH 4.9 076/104] [media] exynos-gsc: Do not swap cb/cr for semi planar formats Greg Kroah-Hartman
2017-10-06  8:51 ` [PATCH 4.9 077/104] MIPS: smp-cps: Fix retrieval of VPE mask on big endian CPUs Greg Kroah-Hartman
2017-10-06  8:51 ` [PATCH 4.9 078/104] nvme-rdma: handle cpu unplug when re-establishing the controller Greg Kroah-Hartman
2017-10-06  8:51 ` [PATCH 4.9 079/104] netfilter: nfnl_cthelper: fix incorrect helper->expect_class_max Greg Kroah-Hartman
2017-10-06  8:51 ` [PATCH 4.9 080/104] parisc: perf: Fix potential NULL pointer dereference Greg Kroah-Hartman
2017-10-06  8:51 ` [PATCH 4.9 081/104] nfs: make nfs4_cb_sv_ops static Greg Kroah-Hartman
2017-10-06  8:52 ` [PATCH 4.9 082/104] ibmvnic: Free tx/rx scrq pointer array when releasing sub-crqs Greg Kroah-Hartman
2017-10-06  8:52 ` [PATCH 4.9 083/104] cpufreq: intel_pstate: Update pid_params.sample_rate_ns in pid_param_set() Greg Kroah-Hartman
2017-10-06  8:52 ` [PATCH 4.9 084/104] x86/acpi: Restore the order of CPU IDs Greg Kroah-Hartman
2017-10-06  8:52 ` [PATCH 4.9 085/104] iommu/io-pgtable-arm: Check for leaf entry before dereferencing it Greg Kroah-Hartman
2017-10-06  8:52 ` [PATCH 4.9 086/104] arm64: kasan: avoid bad virt_to_pfn() Greg Kroah-Hartman
2017-10-06 18:13   ` Mark Rutland
2017-10-07  3:10     ` Levin, Alexander (Sasha Levin)
2017-10-08 15:20       ` Mark Rutland
2017-10-09  9:14       ` Mark Brown
2017-10-09 10:06         ` Will Deacon
2017-10-09 11:42           ` Greg Kroah-Hartman
2017-10-09 14:00             ` Levin, Alexander (Sasha Levin)
2017-10-09 15:47               ` Mark Brown
2017-10-09 16:23                 ` Levin, Alexander (Sasha Levin)
2017-10-09 16:27                   ` Will Deacon
2017-10-09 16:30                   ` Mark Brown
2017-10-09 17:29                     ` Levin, Alexander (Sasha Levin)
2017-10-09 14:10             ` Mark Brown
2017-10-09 16:33       ` Laura Abbott
2017-10-10 17:22         ` Levin, Alexander (Sasha Levin)
2017-10-10 17:31           ` Julia Lawall
2017-11-15 17:43             ` Josh Hunt
2017-11-16 23:13               ` alexander.levin
2017-11-16 23:24                 ` Josh Hunt
2017-11-17  8:06                   ` Greg Kroah-Hartman
2017-10-07  8:42     ` Greg Kroah-Hartman
2017-10-06  8:52 ` [PATCH 4.9 087/104] mm/cgroup: avoid panic when init with low memory Greg Kroah-Hartman
2017-10-06  8:52 ` [PATCH 4.9 088/104] rds: ib: add error handle Greg Kroah-Hartman
2017-10-06  8:52 ` [PATCH 4.9 089/104] md/raid10: submit bio directly to replacement disk Greg Kroah-Hartman
2017-10-06  8:52 ` [PATCH 4.9 090/104] netfilter: nf_tables: set pktinfo->thoff at AH header if found Greg Kroah-Hartman
2017-10-06  8:52 ` [PATCH 4.9 091/104] i2c: meson: fix wrong variable usage in meson_i2c_put_data Greg Kroah-Hartman
2017-10-06  8:52 ` [PATCH 4.9 092/104] xfs: remove kmem_zalloc_greedy Greg Kroah-Hartman
2017-10-06  8:52 ` [PATCH 4.9 093/104] ASoC: wm_adsp: Return an error on write to a disabled volatile control Greg Kroah-Hartman
2017-10-06  8:52 ` [PATCH 4.9 094/104] libata: transport: Remove circular dependency at free time Greg Kroah-Hartman
2017-10-06  8:52 ` [PATCH 4.9 095/104] ARM: dts: BCM5301X: Fix memory start address Greg Kroah-Hartman
2017-10-06  8:52 ` [PATCH 4.9 096/104] tools/power turbostat: bugfix: GFXMHz column not changing Greg Kroah-Hartman
2017-10-06  8:52 ` [PATCH 4.9 097/104] IB/qib: fix false-postive maybe-uninitialized warning Greg Kroah-Hartman
2017-10-06  8:52 ` [PATCH 4.9 099/104] ASoC: rt5514: fix gcc-7 warning Greg Kroah-Hartman
2017-10-06  8:52 ` [PATCH 4.9 100/104] ASoC: rt5659: drop double const Greg Kroah-Hartman
2017-10-06  8:52 ` [PATCH 4.9 101/104] ASoC: rt5660: remove " Greg Kroah-Hartman
2017-10-06  8:52 ` [PATCH 4.9 102/104] ALSA: au88x0: avoid theoretical uninitialized access Greg Kroah-Hartman
2017-10-06  8:52 ` [PATCH 4.9 103/104] [media] ttpci: address stringop overflow warning Greg Kroah-Hartman
2017-10-06  8:52 ` [PATCH 4.9 104/104] s390/mm: make pmdp_invalidate() do invalidation only Greg Kroah-Hartman
2017-10-06 14:08 ` [PATCH 4.9 000/104] 4.9.54-stable review Guenter Roeck
2017-10-07  9:38   ` Greg Kroah-Hartman
2017-10-06 18:06 ` Shuah Khan
2017-10-07  9:39 ` Greg Kroah-Hartman
2017-10-07 14:44   ` Guenter Roeck
2017-10-08  7:20     ` Greg Kroah-Hartman
2017-10-07 16:56 ` Tom Gall
2017-10-08  7:23   ` Greg Kroah-Hartman
2017-10-09 20:37     ` Tom Gall
2017-10-10  7:11       ` Greg Kroah-Hartman
2017-10-10 15:23         ` Dan Rue
2017-10-10 15:33           ` Greg Kroah-Hartman
2017-10-10 15:54             ` Dan Rue
2017-10-10 16:05               ` Greg Kroah-Hartman
2017-10-10 23:11             ` Mark Brown
2017-10-10 15:23         ` Tom Gall
2017-10-10 15:33           ` Greg Kroah-Hartman
2017-10-10 18:39             ` Guenter Roeck
2017-10-10 18:50               ` Greg Kroah-Hartman
2017-10-10 23:14               ` Mark Brown

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=20171006083850.560478827@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=alexander.levin@verizon.com \
    --cc=davem@davemloft.net \
    --cc=idosch@mellanox.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nikolay@cumulusnetworks.com \
    --cc=peter@svinota.eu \
    --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).