forked from Minki/linux
7a99cd6e21
_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:
|
||
---|---|---|
.. | ||
dsa2.c | ||
dsa_priv.h | ||
dsa.c | ||
Kconfig | ||
Makefile | ||
slave.c | ||
tag_brcm.c | ||
tag_dsa.c | ||
tag_edsa.c | ||
tag_qca.c | ||
tag_trailer.c |