]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
net: mdiobus: fix an OF node reference leak
authorJoe Hattori <joe@pf.is.s.u-tokyo.ac.jp>
Wed, 18 Dec 2024 03:51:06 +0000 (12:51 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 27 Dec 2024 12:52:55 +0000 (13:52 +0100)
commit26429dc63e28f442a5d35f01c04d9e86ba88aaa2
tree9cd6dd2aa5333598d9b7f84e167b44637474b157
parent7134f6372c8039cd90e6fbcd977fb723dd05d3bc
net: mdiobus: fix an OF node reference leak

[ Upstream commit 572af9f284669d31d9175122bbef9bc62cea8ded ]

fwnode_find_mii_timestamper() calls of_parse_phandle_with_fixed_args()
but does not decrement the refcount of the obtained OF node. Add an
of_node_put() call before returning from the function.

This bug was detected by an experimental static analysis tool that I am
developing.

Fixes: bc1bee3b87ee ("net: mdiobus: Introduce fwnode_mdiobus_register_phy()")
Signed-off-by: Joe Hattori <joe@pf.is.s.u-tokyo.ac.jp>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Link: https://patch.msgid.link/20241218035106.1436405-1-joe@pf.is.s.u-tokyo.ac.jp
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/mdio/fwnode_mdio.c