linux/drivers/net
Vladimir Oltean cd0a719fbd net: dpaa2-switch: disable the control interface on error path
Currently dpaa2_switch_takedown has a funny name and does not do the
opposite of dpaa2_switch_init, which makes probing fail when we need to
handle an -EPROBE_DEFER.

A sketch of what dpaa2_switch_init does:

	dpsw_open

	dpaa2_switch_detect_features

	dpsw_reset

	for (i = 0; i < ethsw->sw_attr.num_ifs; i++) {
		dpsw_if_disable

		dpsw_if_set_stp

		dpsw_vlan_remove_if_untagged

		dpsw_if_set_tci

		dpsw_vlan_remove_if
	}

	dpsw_vlan_remove

	alloc_ordered_workqueue

	dpsw_fdb_remove

	dpaa2_switch_ctrl_if_setup

When dpaa2_switch_takedown is called from the error path of
dpaa2_switch_probe(), the control interface, enabled by
dpaa2_switch_ctrl_if_setup from dpaa2_switch_init, remains enabled,
because dpaa2_switch_takedown does not call
dpaa2_switch_ctrl_if_teardown.

Since dpaa2_switch_probe might fail due to EPROBE_DEFER of a PHY, this
means that a second probe of the driver will happen with the control
interface directly enabled.

This will trigger a second error:

[   93.273528] fsl_dpaa2_switch dpsw.0: dpsw_ctrl_if_set_pools() failed
[   93.281966] fsl_dpaa2_switch dpsw.0: fsl_mc_driver_probe failed: -13
[   93.288323] fsl_dpaa2_switch: probe of dpsw.0 failed with error -13

Which if we investigate the /dev/dpaa2_mc_console log, we find out is
caused by:

[E, ctrl_if_set_pools:2211, DPMNG]  ctrl_if must be disabled

So make dpaa2_switch_takedown do the opposite of dpaa2_switch_init (in
reasonable limits, no reason to change STP state, re-add VLANs etc), and
rename it to something more conventional, like dpaa2_switch_teardown.

Fixes: 613c0a5810 ("staging: dpaa2-switch: enable the control interface")
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Link: https://lore.kernel.org/r/20210819141755.1931423-1-vladimir.oltean@nxp.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2021-08-19 10:00:59 -07:00
..
appletalk
arcnet
bonding bonding: fix build issue 2021-07-16 17:22:35 -07:00
caif Networking fixes for 5.14-rc2, including fixes from bpf and netfilter. 2021-07-14 09:24:32 -07:00
can can: m_can: m_can_set_bittiming(): fix setting M_CAN_DBTP register 2021-08-10 08:10:27 +02:00
dsa net: dsa: sja1105: fix use-after-free after calling of_find_compatible_node, or worse 2021-08-18 10:21:01 +01:00
ethernet net: dpaa2-switch: disable the control interface on error path 2021-08-19 10:00:59 -07:00
fddi net: fddi: fix UAF in fza_probe 2021-07-13 09:43:50 -07:00
fjes Tracing updates for 5.14: 2021-07-03 11:13:22 -07:00
hamradio net: 6pack: fix slab-out-of-bounds in decode_data 2021-08-16 11:08:05 +01:00
hippi
hyperv Networking changes for 5.14. 2021-06-30 15:51:09 -07:00
ieee802154 ieee802154: hwsim: fix GPF in hwsim_new_edge_nl 2021-07-08 09:37:03 +02:00
ipa Merge branch 'akpm' (patches from Andrew) 2021-07-02 12:08:10 -07:00
ipvlan
mdio net: mdio-mux: Handle -EPROBE_DEFER correctly 2021-08-18 10:48:52 +01:00
mhi net: really fix the build... 2021-08-03 11:14:03 +01:00
netdevsim net: netdevsim: use xso.real_dev instead of xso.dev in callback functions of struct xfrmdev_ops 2021-07-06 10:36:59 -07:00
pcs net: pcs: xpcs: fix error handling on failed to allocate memory 2021-08-11 14:50:54 -07:00
phy net: phy: micrel: Fix link detection on ksz87xx switch" 2021-08-08 12:03:24 +01:00
plip
ppp ppp: Fix generating ppp unit id when ifname is not specified 2021-08-08 13:08:46 +01:00
slip TTY / Serial patches for 5.14-rc1 2021-07-05 14:08:24 -07:00
team
usb r8152: fix the maximum number of PLA bp for RTL8153C 2021-08-19 12:19:30 +01:00
vmxnet3 vmxnet3: fix cksum offload issues for tunnels with non-default udp ports 2021-07-02 13:41:15 -07:00
wan Networking fixes for 5.14-rc2, including fixes from bpf and netfilter. 2021-07-14 09:24:32 -07:00
wireguard
wireless wireless-drivers fixes for v5.14 2021-08-17 15:08:14 -07:00
wwan net: iosm: Prevent underflow in ipc_chnl_cfg_get() 2021-08-16 13:40:18 +01:00
xen-netback
bareudp.c bareudp: Fix invalid read beyond skb's linear data 2021-08-09 15:37:43 -07:00
dummy.c
eql.c
geneve.c
gtp.c gtp: reset mac_header after decap 2021-06-28 12:44:17 -07:00
ifb.c
Kconfig
LICENSE.SRC
loopback.c
macsec.c net: macsec: fix the length used to copy the key for offloading 2021-06-24 12:41:12 -07:00
macvlan.c
macvtap.c
Makefile
mdio.c
mii.c
net_failover.c
netconsole.c
nlmon.c
ntb_netdev.c
rionet.c
sb1000.c
Space.c
sungem_phy.c
tap.c
thunderbolt.c
tun.c
veth.c
virtio_net.c virtio-net: use NETIF_F_GRO_HW instead of NETIF_F_LRO 2021-08-17 10:45:09 +01:00
vrf.c vrf: Reset skb conntrack connection on VRF rcv 2021-08-16 16:37:01 -07:00
vsockmon.c
vxlan.c vxlan: add missing rcu_read_lock() in neigh_reduce() 2021-06-22 09:48:38 -07:00
xen-netfront.c