Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] net: thunder_bgx: fix fwnode leak in bgx_init_of_phy()
@ 2026-08-23 11:12 manushprajwal
  2026-08-23 17:15 ` Markus Elfring
  2026-08-27 15:56 ` Jakub Kicinski
  0 siblings, 2 replies; 3+ messages in thread
From: manushprajwal @ 2026-08-23 11:12 UTC (permalink / raw)
  To: sgoutham; +Cc: davem, edumazet, kuba, pabeni, horms, netdev, linux-arm-kernel

If a child returned by device_for_each_child_node() is not backed by
a device_node, to_of_node() returns NULL and the loop is aborted with
a bare break, without releasing the reference on the current fwnode
that device_for_each_child_node() took. Call fwnode_handle_put()
before breaking out of the loop, mirroring the existing of_node_put()
call a few lines below for the "lmac == bgx->max_lmac" exit path.

Signed-off-by: manushprajwal <manushprajwal555@gmail.com>
---
 drivers/net/ethernet/cavium/thunder/thunder_bgx.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/cavium/thunder/thunder_bgx.c b/drivers/net/ethernet/cavium/thunder/thunder_bgx.c
index b63039999..246eee327 100644
--- a/drivers/net/ethernet/cavium/thunder/thunder_bgx.c
+++ b/drivers/net/ethernet/cavium/thunder/thunder_bgx.c
@@ -1479,8 +1479,10 @@ static int bgx_init_of_phy(struct bgx *bgx)
 		 * cannot handle it, so exit the loop.
 		 */
 		node = to_of_node(fwn);
-		if (!node)
+		if (!node) {
+			fwnode_handle_put(fwn);
 			break;
+		}
 
 		of_get_mac_address(node, bgx->lmac[lmac].mac);
 
-- 
2.46.2.windows.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] net: thunder_bgx: fix fwnode leak in bgx_init_of_phy()
  2026-08-23 11:12 [PATCH 1/2] net: thunder_bgx: fix fwnode leak in bgx_init_of_phy() manushprajwal
@ 2026-08-23 17:15 ` Markus Elfring
  2026-08-27 15:56 ` Jakub Kicinski
  1 sibling, 0 replies; 3+ messages in thread
From: Markus Elfring @ 2026-08-23 17:15 UTC (permalink / raw)
  To: manushprajwal555, netdev, linux-arm-kernel, Andrew Lunn,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Sunil Goutham
  Cc: LKML, kernel-janitors, Simon Horman

> If a child returned by device_for_each_child_node() is not backed by
> a device_node, to_of_node() returns NULL and the loop is aborted with
> a bare break, without releasing the reference on the current fwnode
> that device_for_each_child_node() took. Call fwnode_handle_put()
> before breaking out of the loop, mirroring the existing of_node_put()
> call a few lines below for the "lmac == bgx->max_lmac" exit path.

How do you think about to add any tags (like “Fixes” and “Cc”) accordingly?
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v7.2#n145
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/stable-kernel-rules.rst?h=v7.2#n34

https://elixir.bootlin.com/linux/v7.2/source/drivers/net/ethernet/cavium/thunder/thunder_bgx.c#L1466-L1531

See also once more:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/maintainer-netdev.rst?id=v7.2#n3


Would a cover letter be helpful also for the presented small “patch series”?

Regards,
Markus


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] net: thunder_bgx: fix fwnode leak in bgx_init_of_phy()
  2026-08-23 11:12 [PATCH 1/2] net: thunder_bgx: fix fwnode leak in bgx_init_of_phy() manushprajwal
  2026-08-23 17:15 ` Markus Elfring
@ 2026-08-27 15:56 ` Jakub Kicinski
  1 sibling, 0 replies; 3+ messages in thread
From: Jakub Kicinski @ 2026-08-27 15:56 UTC (permalink / raw)
  To: manushprajwal
  Cc: sgoutham, davem, edumazet, pabeni, horms, netdev,
	linux-arm-kernel

On Sun, 23 Aug 2026 16:42:31 +0530 manushprajwal wrote:
> Subject: [PATCH 1/2] net: thunder_bgx: fix fwnode leak in bgx_init_of_phy()

We never saw patch 2/2, you need to repost it as standalone or send
both to netdev.
-- 
pw-bot: cr


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-08-27 15:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-23 11:12 [PATCH 1/2] net: thunder_bgx: fix fwnode leak in bgx_init_of_phy() manushprajwal
2026-08-23 17:15 ` Markus Elfring
2026-08-27 15:56 ` Jakub Kicinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox