net: thunder_bgx: Fix refcount leak bug in bgx_init_of_phy()
Subsystems (2)
PATCH 1/1 net: thunder_bgx: Fix refcount leak bug in bgx_init_of_phy()
We should call of_node_put() for the reference returned by of_parse_phandle() in fail path or when it is not used anymore.
Fixes eee326fd8334 ("net: thunderx: bgx: Use standard firmware node infrastructure.")
Signed-off-by Liang He <[email protected]>
--- drivers/net/ethernet/cavium/thunder/thunder_bgx.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/ethernet/cavium/thunder/thunder_bgx.c +4 -1
@@ -1494,10 +1494,13 @@ static int bgx_init_of_phy(struct bgx *bgx) !of_device_is_compatible(phy_np, "cortina,cs4223-slice")) {/* Wait until the phy drivers are available */ pd =of_phy_find_device (phy_np); -if (!pd) +if (!pd) { +of_node_put (phy_np); goto defer; + } bgx->lmac[lmac].phydev = pd; } +of_node_put (phy_np); lmac++;if (lmac == bgx->max_lmac) {
Signature · 7 lines
2.25.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Jakub Kicinski
maintainerQuoted 6 lines · On Fri, 22 Jul 2022 23:20:48 +0800 Liang He wrote:
We should call
of_node_put()for the reference returned byof_parse_phandle()in fail path or when it is not used anymore.Fixes eee326fd8334 ("net: thunderx: bgx: Use standard firmware node infrastructure.")Signed-off-by Liang He <[email protected]>
cc netdev@
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel