From: Sasha Levin <Alexander.Levin@microsoft.com>
To: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"stable@vger.kernel.org" <stable@vger.kernel.org>
Cc: Andrew Lunn <andrew@lunn.ch>,
"David S . Miller" <davem@davemloft.net>,
Sasha Levin <Alexander.Levin@microsoft.com>
Subject: [PATCH AUTOSEL for 4.14 069/100] net: dsa: mv88e6xxx: Unregister MDIO bus on error path
Date: Sun, 28 Jan 2018 22:26:43 +0000 [thread overview]
Message-ID: <20180128222547.7398-69-alexander.levin@microsoft.com> (raw)
In-Reply-To: <20180128222547.7398-1-alexander.levin@microsoft.com>
From: Andrew Lunn <andrew@lunn.ch>
[ Upstream commit 3126aeec5313565bfa19e2dd8fd7e3c3390514cb ]
The MDIO busses need to be unregistered before they are freed,
otherwise BUG() is called. Add a call to the unregister code if the
registration fails, since we can have multiple busses, of which some
may correctly register before one fails. This requires moving the code
around a little.
Fixes: a3c53be55c95 ("net: dsa: mv88e6xxx: Support multiple MDIO busses")
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
---
drivers/net/dsa/mv88e6xxx/chip.c | 30 ++++++++++++++++--------------
1 file changed, 16 insertions(+), 14 deletions(-)
diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
index 07704b372861..eebda5ec9676 100644
--- a/drivers/net/dsa/mv88e6xxx/chip.c
+++ b/drivers/net/dsa/mv88e6xxx/chip.c
@@ -2153,6 +2153,19 @@ static const struct of_device_id mv88e6xxx_mdio_external_match[] = {
{ },
};
+static void mv88e6xxx_mdios_unregister(struct mv88e6xxx_chip *chip)
+
+{
+ struct mv88e6xxx_mdio_bus *mdio_bus;
+ struct mii_bus *bus;
+
+ list_for_each_entry(mdio_bus, &chip->mdios, list) {
+ bus = mdio_bus->bus;
+
+ mdiobus_unregister(bus);
+ }
+}
+
static int mv88e6xxx_mdios_register(struct mv88e6xxx_chip *chip,
struct device_node *np)
{
@@ -2177,27 +2190,16 @@ static int mv88e6xxx_mdios_register(struct mv88e6xxx_chip *chip,
match = of_match_node(mv88e6xxx_mdio_external_match, child);
if (match) {
err = mv88e6xxx_mdio_register(chip, child, true);
- if (err)
+ if (err) {
+ mv88e6xxx_mdios_unregister(chip);
return err;
+ }
}
}
return 0;
}
-static void mv88e6xxx_mdios_unregister(struct mv88e6xxx_chip *chip)
-
-{
- struct mv88e6xxx_mdio_bus *mdio_bus;
- struct mii_bus *bus;
-
- list_for_each_entry(mdio_bus, &chip->mdios, list) {
- bus = mdio_bus->bus;
-
- mdiobus_unregister(bus);
- }
-}
-
static int mv88e6xxx_get_eeprom_len(struct dsa_switch *ds)
{
struct mv88e6xxx_chip *chip = ds->priv;
--
2.11.0
next prev parent reply other threads:[~2018-01-28 22:27 UTC|newest]
Thread overview: 99+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-28 22:25 [PATCH AUTOSEL for 4.14 001/100] usb: build drivers/usb/common/ when USB_SUPPORT is set Sasha Levin
2018-01-28 22:25 ` [PATCH AUTOSEL for 4.14 002/100] serdev: fix receive_buf return value when no callback Sasha Levin
2018-01-28 22:25 ` [PATCH AUTOSEL for 4.14 003/100] ARM: OMAP2+: Fix SRAM virt to phys translation for save_secure_ram_context Sasha Levin
2018-01-28 22:25 ` [PATCH AUTOSEL for 4.14 004/100] ARM: AM33xx: PRM: Remove am33xx_pwrdm_read_prev_pwrst function Sasha Levin
2018-01-28 22:25 ` [PATCH AUTOSEL for 4.14 005/100] ARM: dts: Fix omap4 hang with GPS connected to USB by using wakeupgen Sasha Levin
2018-01-28 22:25 ` [PATCH AUTOSEL for 4.14 006/100] ARM: dts: logicpd-som-lv: Fix gpmc addresses for NAND and enet Sasha Levin
2018-01-28 22:25 ` [PATCH AUTOSEL for 4.14 007/100] ARM: dts: logicpd-somlv: Fix wl127x pinmux Sasha Levin
2018-01-28 22:26 ` [PATCH AUTOSEL for 4.14 008/100] ARM: dts: am4372: Correct the interrupts_properties of McASP Sasha Levin
2018-01-28 22:26 ` [PATCH AUTOSEL for 4.14 009/100] ARM: dts: am437x-cm-t43: Correct the dmas property of spi0 Sasha Levin
2018-01-28 22:26 ` [PATCH AUTOSEL for 4.14 010/100] perf record: Fix -c/-F options for cpu event aliases Sasha Levin
2018-01-28 22:26 ` [PATCH AUTOSEL for 4.14 011/100] perf help: Fix a bug during strstart() conversion Sasha Levin
2018-01-28 22:26 ` [PATCH AUTOSEL for 4.14 012/100] perf annotate: Do not truncate instruction names at 6 chars Sasha Levin
2018-01-28 22:26 ` [PATCH AUTOSEL for 4.14 013/100] perf test shell: Fix check open filename arg using 'perf trace' on s390x Sasha Levin
2018-01-28 22:26 ` [PATCH AUTOSEL for 4.14 014/100] perf: Fix header.size for namespace events Sasha Levin
2018-01-28 22:26 ` [PATCH AUTOSEL for 4.14 015/100] perf top: Fix window dimensions change handling Sasha Levin
2018-01-28 22:26 ` [PATCH AUTOSEL for 4.14 016/100] perf bench numa: Fixup discontiguous/sparse numa nodes Sasha Levin
2018-01-28 22:26 ` [PATCH AUTOSEL for 4.14 017/100] perf test: Fix test 21 for s390x Sasha Levin
2018-01-28 22:26 ` [PATCH AUTOSEL for 4.14 018/100] pinctrl: denverton: Fix UART2 RTS pin mode Sasha Levin
2018-01-28 22:26 ` [PATCH AUTOSEL for 4.14 019/100] kvm: arm: don't treat unavailable HYP mode as an error Sasha Levin
2018-01-28 22:26 ` [PATCH AUTOSEL for 4.14 020/100] trace/xdp: fix compile warning: 'struct bpf_map' declared inside parameter list Sasha Levin
2018-01-28 22:26 ` [PATCH AUTOSEL for 4.14 021/100] media: s5k6aa: describe some function parameters Sasha Levin
2018-01-28 22:26 ` [PATCH AUTOSEL for 4.14 022/100] media: ov13858: Select V4L2_FWNODE Sasha Levin
2018-01-28 22:26 ` [PATCH AUTOSEL for 4.14 023/100] net: mvpp2: allocate zeroed tx descriptors Sasha Levin
2018-01-28 22:26 ` [PATCH AUTOSEL for 4.14 024/100] gpio: 74x164: Fix crash during .remove() Sasha Levin
2018-01-28 22:26 ` [PATCH AUTOSEL for 4.14 025/100] gpio: davinci: Assign first bank regs for unbanked case Sasha Levin
2018-01-28 22:26 ` [PATCH AUTOSEL for 4.14 026/100] pinctrl: sunxi: Fix A80 interrupt pin bank Sasha Levin
2018-01-28 22:26 ` [PATCH AUTOSEL for 4.14 027/100] pinctrl: sunxi: Fix A64 UART mux value Sasha Levin
2018-01-28 22:26 ` [PATCH AUTOSEL for 4.14 029/100] meson-gx-socinfo: Fix package id parsing Sasha Levin
2018-01-28 22:26 ` [PATCH AUTOSEL for 4.14 028/100] IB/hfi1: Initialize bth1 in 16B rc ack builder Sasha Levin
2018-01-28 22:26 ` [PATCH AUTOSEL for 4.14 030/100] KVM: arm/arm64: Fix spinlock acquisition in vgic_set_owner Sasha Levin
2018-01-28 22:26 ` [PATCH AUTOSEL for 4.14 031/100] i40iw: Allocate a sdbuf per CQP WQE Sasha Levin
2018-01-28 22:26 ` [PATCH AUTOSEL for 4.14 032/100] i40iw: Do not free sqbuf when event is I40IW_TIMER_TYPE_CLOSE Sasha Levin
2018-01-28 22:26 ` [PATCH AUTOSEL for 4.14 033/100] i40iw: Correct ARP index mask Sasha Levin
2018-01-28 22:26 ` [PATCH AUTOSEL for 4.14 034/100] RDMA/cma: Make sure that PSN is not over max allowed Sasha Levin
2018-01-28 22:26 ` [PATCH AUTOSEL for 4.14 035/100] IB/core: Init subsys if compiled to vmlinuz-core Sasha Levin
2018-01-28 22:26 ` [PATCH AUTOSEL for 4.14 036/100] md/raid5: correct degraded calculation in raid5_error Sasha Levin
2018-01-28 22:26 ` [PATCH AUTOSEL for 4.14 037/100] sctp: only update outstanding_bytes for transmitted queue when doing prsctp_prune Sasha Levin
2018-01-28 22:26 ` [PATCH AUTOSEL for 4.14 039/100] phylink: ensure we take the link down when phylink_stop() is called Sasha Levin
2018-01-28 22:26 ` [PATCH AUTOSEL for 4.14 038/100] sfp: fix RX_LOS signal handling Sasha Levin
2018-01-28 22:26 ` [PATCH AUTOSEL for 4.14 041/100] iio: proximity: sx9500: Assign interrupt from GpioIo() Sasha Levin
2018-01-28 22:26 ` [PATCH AUTOSEL for 4.14 040/100] md/raid1/10: add missed blk plug Sasha Levin
2018-01-28 22:26 ` [PATCH AUTOSEL for 4.14 042/100] iio: fix kernel-doc build errors Sasha Levin
2018-01-28 22:26 ` [PATCH AUTOSEL for 4.14 044/100] bnxt_en: Need to unconditionally shut down RoCE in bnxt_shutdown Sasha Levin
2018-01-28 22:26 ` [PATCH AUTOSEL for 4.14 043/100] scripts/kernel-doc: Don't fail with status != 0 if error encountered with -none Sasha Levin
2018-01-28 22:26 ` [PATCH AUTOSEL for 4.14 045/100] ipvlan: Add the skb->mark as flow4's member to lookup route Sasha Levin
2018-01-28 22:26 ` [PATCH AUTOSEL for 4.14 046/100] m68k: add missing SOFTIRQENTRY_TEXT linker section Sasha Levin
2018-01-28 22:26 ` [PATCH AUTOSEL for 4.14 047/100] powerpc/perf: Fix oops when grouping different pmu events Sasha Levin
2018-01-28 22:26 ` [PATCH AUTOSEL for 4.14 049/100] s390/virtio: add BSD license to virtio-ccw Sasha Levin
2018-01-28 22:26 ` [PATCH AUTOSEL for 4.14 048/100] PM / runtime: Fix handling of suppliers with disabled runtime PM Sasha Levin
2018-01-28 22:26 ` [PATCH AUTOSEL for 4.14 051/100] ARM: dts: Fix elm interrupt compiler warning Sasha Levin
2018-01-28 22:26 ` [PATCH AUTOSEL for 4.14 050/100] s390/dasd: prevent prefix I/O error Sasha Levin
2018-01-28 22:26 ` [PATCH AUTOSEL for 4.14 052/100] nfp: fix port stats for mac representors Sasha Levin
2018-01-28 22:26 ` [PATCH AUTOSEL for 4.14 054/100] net_sched: red: Avoid devision by zero Sasha Levin
2018-01-28 22:26 ` [PATCH AUTOSEL for 4.14 053/100] gianfar: fix a flooded alignment reports because of padding issue Sasha Levin
2018-01-28 22:26 ` [PATCH AUTOSEL for 4.14 055/100] net_sched: red: Avoid illegal values Sasha Levin
2018-01-28 22:26 ` [PATCH AUTOSEL for 4.14 057/100] KVM: VMX: fix page leak in hardware_setup() Sasha Levin
2018-01-28 22:26 ` [PATCH AUTOSEL for 4.14 056/100] VSOCK: fix outdated sk_state value in hvs_release() Sasha Levin
2018-01-28 22:26 ` [PATCH AUTOSEL for 4.14 058/100] net: qualcomm: rmnet: Fix leak on transmit failure Sasha Levin
2018-01-28 22:26 ` [PATCH AUTOSEL for 4.14 059/100] dccp: CVE-2017-8824: use-after-free in DCCP code Sasha Levin
2018-01-28 22:26 ` [PATCH AUTOSEL for 4.14 061/100] sched/wait: Fix add_wait_queue() behavioral change Sasha Levin
2018-01-28 22:26 ` [PATCH AUTOSEL for 4.14 060/100] locking/lockdep: Fix possible NULL deref Sasha Levin
2018-01-28 22:26 ` [PATCH AUTOSEL for 4.14 062/100] btrfs: Fix quota reservation leak on preallocated files Sasha Levin
2018-01-28 22:26 ` [PATCH AUTOSEL for 4.14 063/100] Btrfs: disable FUA if mounted with nobarrier Sasha Levin
2018-01-28 22:26 ` [PATCH AUTOSEL for 4.14 064/100] btrfs: Fix possible off-by-one in btrfs_search_path_in_tree Sasha Levin
2018-01-28 22:26 ` [PATCH AUTOSEL for 4.14 065/100] brcmfmac: Avoid build error with make W=1 Sasha Levin
2018-01-28 22:26 ` [PATCH AUTOSEL for 4.14 067/100] net: ethernet: arc: fix error handling in emac_rockchip_probe Sasha Levin
2018-01-28 22:26 ` [PATCH AUTOSEL for 4.14 066/100] virtio_net: fix return value check in receive_mergeable() Sasha Levin
2018-01-28 22:26 ` [PATCH AUTOSEL for 4.14 068/100] net: dsa: mv88e6xxx: Fix interrupt masking on removal Sasha Levin
2018-01-28 22:26 ` Sasha Levin [this message]
2018-01-28 22:26 ` [PATCH AUTOSEL for 4.14 070/100] 509: fix printing uninitialized stack memory when OID is empty Sasha Levin
2018-01-28 22:26 ` [PATCH AUTOSEL for 4.14 071/100] gianfar: Disable EEE autoneg by default Sasha Levin
2018-01-28 22:26 ` [PATCH AUTOSEL for 4.14 072/100] scsi: lpfc: Use after free in lpfc_rq_buf_free() Sasha Levin
2018-01-28 22:26 ` [PATCH AUTOSEL for 4.14 073/100] scsi: bfa: fix access to bfad_im_port_s Sasha Levin
2018-01-28 22:26 ` [PATCH AUTOSEL for 4.14 075/100] dmaengine: at_hdmac: fix potential NULL pointer dereference in atc_prep_dma_interleaved Sasha Levin
2018-01-28 22:26 ` [PATCH AUTOSEL for 4.14 074/100] dmaengine: ioat: Fix error handling path Sasha Levin
2018-01-28 22:26 ` [PATCH AUTOSEL for 4.14 076/100] xfrm: Fix xfrm_input() to verify state is valid when (encap_type < 0) Sasha Levin
2018-01-28 22:26 ` [PATCH AUTOSEL for 4.14 078/100] netfilter: nfnetlink_cthelper: Add missing permission checks Sasha Levin
2018-01-28 22:26 ` [PATCH AUTOSEL for 4.14 077/100] xfrm: Fix stack-out-of-bounds read on socket policy lookup Sasha Levin
2018-01-28 22:26 ` [PATCH AUTOSEL for 4.14 079/100] netfilter: xt_bpf: add overflow checks Sasha Levin
2018-01-28 22:26 ` [PATCH AUTOSEL for 4.14 080/100] clk: fix a panic error caused by accessing NULL pointer Sasha Levin
2018-01-28 22:26 ` [PATCH AUTOSEL for 4.14 081/100] netfilter: xt_osf: Add missing permission checks Sasha Levin
2018-01-28 22:26 ` [PATCH AUTOSEL for 4.14 082/100] staging: ccree: Uninitialized return in ssi_ahash_import() Sasha Levin
2018-01-28 22:26 ` [PATCH AUTOSEL for 4.14 083/100] ASoC: rockchip: disable clock on error Sasha Levin
2018-01-28 22:26 ` [PATCH AUTOSEL for 4.14 084/100] spi: sun4i: disable clocks in the remove function Sasha Levin
2018-01-28 22:26 ` [PATCH AUTOSEL for 4.14 085/100] IB/mlx4: Fix RSS hash fields restrictions Sasha Levin
2018-01-28 22:26 ` [PATCH AUTOSEL for 4.14 086/100] RDMA/netlink: Fix general protection fault Sasha Levin
2018-01-28 22:26 ` [PATCH AUTOSEL for 4.14 087/100] xfrm: Fix stack-out-of-bounds with misconfigured transport mode policies Sasha Levin
2018-01-28 22:26 ` [PATCH AUTOSEL for 4.14 088/100] drm/armada: fix leak of crtc structure Sasha Levin
2018-01-28 22:26 ` [PATCH AUTOSEL for 4.14 089/100] ASoC: rsnd: ssi: fix race condition in rsnd_ssi_pointer_update Sasha Levin
2018-01-28 22:26 ` [PATCH AUTOSEL for 4.14 090/100] drm/vc4: Release fence after signalling Sasha Levin
2018-01-28 22:26 ` [PATCH AUTOSEL for 4.14 092/100] usb: dwc3: gadget: Wait longer for controller to end command processing Sasha Levin
2018-01-28 22:26 ` [PATCH AUTOSEL for 4.14 091/100] dmaengine: jz4740: disable/unprepare clk if probe fails Sasha Levin
2018-01-28 22:27 ` [PATCH AUTOSEL for 4.14 093/100] usb: dwc3: of-simple: fix missing clk_disable_unprepare Sasha Levin
2018-01-28 22:27 ` [PATCH AUTOSEL for 4.14 095/100] x86/mm/kmmio: Fix mmiotrace for page unaligned addresses Sasha Levin
2018-01-28 22:27 ` [PATCH AUTOSEL for 4.14 096/100] platform/x86: dell-laptop: Fix keyboard max lighting for Dell Latitude E6410 Sasha Levin
2018-01-28 22:27 ` [PATCH AUTOSEL for 4.14 097/100] xen: XEN_ACPI_PROCESSOR is Dom0-only Sasha Levin
2018-01-28 22:27 ` [PATCH AUTOSEL for 4.14 098/100] PCI: rcar: Fix use-after-free in probe error path Sasha Levin
2018-01-28 22:27 ` [PATCH AUTOSEL for 4.14 100/100] hippi: Fix a Fix a possible sleep-in-atomic bug in rr_close Sasha Levin
2018-01-28 22:27 ` [PATCH AUTOSEL for 4.14 099/100] powerpc/perf/imc: Fix nest-imc cpuhotplug callback failure Sasha Levin
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=20180128222547.7398-69-alexander.levin@microsoft.com \
--to=alexander.levin@microsoft.com \
--cc=andrew@lunn.ch \
--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).