]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
net: mv643xx_eth: fix an OF node reference leak
authorJoe Hattori <joe@pf.is.s.u-tokyo.ac.jp>
Sat, 21 Dec 2024 08:14:48 +0000 (17:14 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 9 Jan 2025 12:30:01 +0000 (13:30 +0100)
commit274cb294fa049f6114b605b2a8707b3cb12f86e3
tree3f28b0f116587b54099fcaba28295221f7a583c5
parent847c4daa21c72f663130ab07ce7b0f8a5c4adb22
net: mv643xx_eth: fix an OF node reference leak

[ Upstream commit ad5c318086e2e23b577eca33559c5ebf89bc7eb9 ]

Current implementation of mv643xx_eth_shared_of_add_port() calls
of_parse_phandle(), but does not release the refcount on error. Call
of_node_put() in the error path and in mv643xx_eth_shared_of_remove().

This bug was found by an experimental verification tool that I am
developing.

Fixes: 76723bca2802 ("net: mv643xx_eth: add DT parsing support")
Signed-off-by: Joe Hattori <joe@pf.is.s.u-tokyo.ac.jp>
Link: https://patch.msgid.link/20241221081448.3313163-1-joe@pf.is.s.u-tokyo.ac.jp
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/marvell/mv643xx_eth.c