net: dsa: microchip: ksz_common: Fix refcount leak bug
authorLiang He <windhl@126.com>
Thu, 14 Jul 2022 15:31:38 +0000 (23:31 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 29 Jul 2022 15:25:15 +0000 (17:25 +0200)
commit88ec2ff42da3ac93b2437dc52fe25cd4372148e6
treea27e74e9577fd3eb9eb90714f26ea3ddc17c777a
parent212a5360ef4063f3ea3752e6e6a7e73e8e82acbd
net: dsa: microchip: ksz_common: Fix refcount leak bug

[ Upstream commit a14bd7475452c51835dd5a0cee4c8fa48dd0b539 ]

In ksz_switch_register(), we should call of_node_put() for the
reference returned by of_get_child_by_name() which has increased
the refcount.

Fixes: 912aae27c6af ("net: dsa: microchip: really look for phy-mode in port nodes")
Signed-off-by: Liang He <windhl@126.com>
Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
Link: https://lore.kernel.org/r/20220714153138.375919-1-windhl@126.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/dsa/microchip/ksz_common.c