linux_dsm_epyc7002/net
Nikita Yushchenko 7a99cd6e21 net: dsa: fix unbalanced dsa_switch_tree reference counting
_dsa_register_switch() gets a dsa_switch_tree object either via
dsa_get_dst() or via dsa_add_dst(). Former path does not increase kref
in returned object (resulting into caller not owning a reference),
while later path does create a new object (resulting into caller owning
a reference).

The rest of _dsa_register_switch() assumes that it owns a reference, and
calls dsa_put_dst().

This causes a memory breakage if first switch in the tree initialized
successfully, but second failed to initialize. In particular, freed
dsa_swith_tree object is left referenced by switch that was initialized,
and later access to sysfs attributes of that switch cause OOPS.

To fix, need to add kref_get() call to dsa_get_dst().

Fixes: 83c0afaec7 ("net: dsa: Add new binding implementation")
Signed-off-by: Nikita Yushchenko <nikita.yoush@cogentembedded.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-11-28 16:15:45 -05:00
..
6lowpan
9p
802
8021q
appletalk
atm
ax25
batman-adv
bluetooth
bridge
caif
can
ceph
core Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec 2016-11-27 20:21:48 -05:00
dcb
dccp
decnet
dns_resolver
dsa net: dsa: fix unbalanced dsa_switch_tree reference counting 2016-11-28 16:15:45 -05:00
ethernet
hsr
ieee802154
ipv4 tcp: Set DEFAULT_TCP_CONG to bbr if DEFAULT_BBR is set 2016-11-28 12:15:00 -05:00
ipv6 net: handle no dst on skb in icmp6_send 2016-11-28 16:13:01 -05:00
ipx
irda
iucv
kcm
key
l2tp
l3mdev
lapb
llc
mac80211
mac802154
mpls
ncsi
netfilter
netlabel
netlink
netrom
nfc
openvswitch
packet
phonet
qrtr
rds
rfkill
rose
rxrpc
sched net, sched: respect rcu grace period on cls destruction 2016-11-28 10:47:35 -05:00
sctp
strparser
sunrpc
switchdev
tipc tipc: fix link statistics counter errors 2016-11-27 20:35:55 -05:00
unix
vmw_vsock
wimax
wireless
x25
xfrm
compat.c
Kconfig
Makefile
socket.c
sysctl_net.c