linux/drivers/net
Vladimir Oltean 9916fdd8a2 net: dsa: qca8k: put MDIO bus OF node on qca8k_mdio_register() failure
[ Upstream commit 68e1010cda ]

of_get_child_by_name() gives us an OF node with an elevated refcount,
which should be dropped when we're done with it. This is so that,
if (of_node_check_flag(node, OF_DYNAMIC)) is true, the node's memory can
eventually be freed.

There are 2 distinct paths to be considered in qca8k_mdio_register():

- devm_of_mdiobus_register() succeeds: since commit 3b73a7b8ec ("net:
  mdio_bus: add refcounting for fwnodes to mdiobus"), the MDIO core
  treats this well.

- devm_of_mdiobus_register() or anything up to that point fails: it is
  the duty of the qca8k driver to release the OF node.

This change addresses the second case by making sure that the OF node
reference is not leaked.

The "mdio" node may be NULL, but of_node_put(NULL) is safe.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Alvin Šipraga <alsi@bang-olufsen.dk>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-02-05 20:14:25 +00:00
..
appletalk
arcnet arcnet: restoring support for multiple Sohard Arcnet cards 2023-12-13 18:45:05 +01:00
bonding bonding: return -ENOMEM instead of BUG in alb_upper_dev_walk 2024-02-05 20:14:19 +00:00
caif
can can: dev: can_put_echo_skb(): don't crash kernel if can_priv::echo_skb is accessed out of bounds 2023-11-20 11:59:00 +01:00
dsa net: dsa: qca8k: put MDIO bus OF node on qca8k_mdio_register() failure 2024-02-05 20:14:25 +00:00
ethernet octeontx2-af: Fix max NPC MCAM entry check while validating ref_entry 2024-02-05 20:14:25 +00:00
fddi
fjes fjes: fix memleaks in fjes_hw_setup 2024-01-31 16:19:05 -08:00
hamradio
hippi
hyperv hv_netvsc: Calculate correct ring size when PAGE_SIZE is not 4 Kbytes 2024-01-31 16:19:06 -08:00
ieee802154 net: ieee802154: adf7242: Fix some potential buffer overflow in adf7242_stats_show() 2023-10-22 11:28:43 +01:00
ipa net: ipa: fix one GSI register field width 2023-12-03 07:33:05 +01:00
ipvlan ipvlan: add ipvlan_route_v6_outbound() helper 2023-11-28 17:19:50 +00:00
mctp
mdio net: mdio-mux: fix C45 access returning -EIO after API change 2023-10-18 18:08:23 -07:00
netdevsim net: netdevsim: don't try to destroy PHC on VFs 2024-01-25 15:35:59 -08:00
pcs net: pcs: xpcs: adapt Wangxun NICs for SGMII mode 2023-08-25 07:42:59 +01:00
phy net: phy: at803x: fix passing the wrong reference for config_intr 2024-02-05 20:14:22 +00:00
plip
ppp ppp: limit MRU to 64K 2023-11-28 17:19:51 +00:00
pse-pd
slip
team team: Fix use-after-free when an option instance allocation fails 2023-12-20 17:02:02 +01:00
thunderbolt net: thunderbolt: Fix TCPv6 GSO checksum calculation 2023-09-15 13:45:05 +01:00
usb net: usb: ax88179_178a: avoid two consecutive device resets 2024-02-05 20:14:19 +00:00
vmxnet3
vxlan vxlan: Add missing entries to vxlan_get_size() 2023-09-20 09:00:54 +01:00
wan drivers/net: process the result of hdlc_open() and add call of hdlc_close() in uhdlc_close() 2023-09-22 08:19:18 +01:00
wireguard wireguard: use DEV_STATS_INC() 2023-12-03 07:33:03 +01:00
wireless wifi: rtlwifi: rtl8723{be,ae}: using calculate_bit_shift() 2024-02-05 20:14:24 +00:00
wwan Revert "net: wwan: iosm: enable runtime pm support for 7560" 2023-10-18 11:08:52 +01:00
xen-netback xen-netback: don't produce zero-size SKB frags 2024-01-25 15:35:41 -08:00
amt.c amt: do not use overwrapped cb area 2024-01-25 15:35:56 -08:00
bareudp.c
dummy.c
eql.c
geneve.c
gtp.c udp: annotate data-races around udp->encap_type 2023-11-20 11:58:56 +01:00
ifb.c
Kconfig
LICENSE.SRC
loopback.c
macsec.c net: add DEV_STATS_READ() helper 2023-11-20 11:59:04 +01:00
macvlan.c macvlan: Don't propagate promisc change to lower dev in passthru 2023-11-28 17:19:54 +00:00
macvtap.c
Makefile
mdio.c
mhi_net.c
mii.c
net_failover.c
netconsole.c
nlmon.c
ntb_netdev.c
rionet.c
sb1000.c
Space.c
sungem_phy.c
tap.c
tun.c tun: add missing rx stats accounting in tun_xdp_act 2024-01-31 16:19:01 -08:00
veth.c veth: Use tstats per-CPU traffic counters 2023-12-03 07:33:09 +01:00
virtio_net.c virtio_net: fix missing dma unmap for resize 2024-01-10 17:16:52 +01:00
vrf.c net: Move {l,t,d}stats allocation to core and convert veth & vrf 2023-12-03 07:33:04 +01:00
vsockmon.c
xen-netfront.c