aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorRosen Penev <rosenp@gmail.com>2025-09-01 14:33:14 -0700
committerJakub Kicinski <kuba@kernel.org>2025-09-03 16:56:36 -0700
commit9e3d71a92e561ccc77025689dab25d201fee7a3e (patch)
tree4be8ed97f4a1ab1fa50d85f5eaaabbcf8255bbae
parentnet: thunder_bgx: add a missing of_node_put (diff)
downloadwireguard-linux-9e3d71a92e561ccc77025689dab25d201fee7a3e.tar.xz
wireguard-linux-9e3d71a92e561ccc77025689dab25d201fee7a3e.zip
net: thunder_bgx: decrement cleanup index before use
All paths in probe that call goto defer do so before assigning phydev and thus it makes sense to cleanup the prior index. It also fixes a bug where index 0 does not get cleaned up. Fixes: b7d3e3d3d21a ("net: thunderx: Don't leak phy device references on -EPROBE_DEFER condition.") Signed-off-by: Rosen Penev <rosenp@gmail.com> Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev> Reviewed-by: Simon Horman <horms@kernel.org> Link: https://patch.msgid.link/20250901213314.48599-1-rosenp@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
-rw-r--r--drivers/net/ethernet/cavium/thunder/thunder_bgx.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/ethernet/cavium/thunder/thunder_bgx.c b/drivers/net/ethernet/cavium/thunder/thunder_bgx.c
index 0f913db4814e..9efb60842ad1 100644
--- a/drivers/net/ethernet/cavium/thunder/thunder_bgx.c
+++ b/drivers/net/ethernet/cavium/thunder/thunder_bgx.c
@@ -1519,11 +1519,11 @@ defer:
* for phy devices we may have already found.
*/
while (lmac) {
+ lmac--;
if (bgx->lmac[lmac].phydev) {
put_device(&bgx->lmac[lmac].phydev->mdio.dev);
bgx->lmac[lmac].phydev = NULL;
}
- lmac--;
}
of_node_put(node);
return -EPROBE_DEFER;