Centos-kernel-stream-9/net
Russell King e496ae690b net: dsa: fix of_mdio_find_bus() device refcount leak
Current users of of_mdio_find_bus() leak a struct device refcount, as
they fail to clean up the reference obtained inside class_find_device().

Fix the DSA code to properly refcount the returned MDIO bus by:
1. taking a reference on the struct device whenever we assign it to
   pd->chip[x].host_dev.
2. dropping the reference when we overwrite the existing reference.
3. dropping the reference when we free the data structure.
4. dropping the initial reference we obtained after setting up the
   platform data structure, or on failure.

In step 2 above, where we obtain a new MDIO bus, there is no need to
take a reference on it as we would only have to drop it immediately
after assignment again, iow:

	put_device(cd->host_dev);	/* drop original assignment ref */
	cd->host_dev = get_device(&mdio_bus_switch->dev); /* get our ref */
	put_device(&mdio_bus_switch->dev); /* drop of_mdio_find_bus ref */

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
2015-09-24 23:04:52 -07:00
..
6lowpan
9p
802
8021q
appletalk
atm
ax25
batman-adv
bluetooth
bridge
caif
can
ceph
core fib_rules: fix fib rule dumps across multiple skbs 2015-09-24 15:21:54 -07:00
dcb
dccp tcp/dccp: fix timewait races in timer handling 2015-09-21 16:32:29 -07:00
decnet
dns_resolver
dsa net: dsa: fix of_mdio_find_bus() device refcount leak 2015-09-24 23:04:52 -07:00
ethernet
hsr
ieee802154
ipv4 lwtunnel: remove source and destination UDP port config option 2015-09-24 14:31:37 -07:00
ipv6 ip6_tunnel: Reduce log level in ip6_tnl_err() to debug 2015-09-24 16:08:37 -07:00
ipx
irda
iucv
key
l2tp
lapb
llc
mac80211 mac80211: reset CQM history upon reconfiguration 2015-09-22 15:22:50 +02:00
mac802154
mpls
netfilter
netlabel
netlink netlink: Replace rhash_portid with bound 2015-09-24 12:07:08 -07:00
netrom
nfc
openvswitch openvswitch: Zero flows on allocation. 2015-09-22 17:33:41 -07:00
packet Fix AF_PACKET ABI breakage in 4.2 2015-09-23 14:33:55 -07:00
phonet
rds
rfkill
rose
rxrpc
sched net: revert "net_sched: move tp->root allocation into fw_init()" 2015-09-24 14:33:30 -07:00
sctp
sunrpc
switchdev
tipc
unix
vmw_vsock
wimax
wireless
x25
xfrm
Kconfig
Makefile
compat.c
socket.c
sysctl_net.c