* [PATCH net] fsl/fman: Drop device references when dpaa_eth_add_device() fails
@ 2026-11-26 9:37 Yige Jiang
2026-11-26 9:42 ` netdev-bot+sinfo
0 siblings, 1 reply; 3+ messages in thread
From: Yige Jiang @ 2026-11-26 9:37 UTC (permalink / raw)
To: Madalin Bucur, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni
Cc: Yige Jiang, Sean Anderson, netdev, linux-kernel
When dpaa_eth_add_device() fails at the end of mac_probe(), the error
is returned directly. This skips the _return_dev_arr_put and
_return_dev_put labels, so the references held on the FMan device and
on both FMan port devices are never dropped. mac_remove() would drop
them, but it does not run after a failed probe.
Jump to _return_dev_arr_put instead, as the init() failure above does.
The devices are created from the device tree and are not normally
removed, so the leaked references have no visible effect in practice.
The MAC state allocated by init() is still not freed on this path, as
in mac_remove(); that needs a separate change.
Fixes: 1dec67e0d9fb ("fsl/fman: Fix refcount handling of fman-related devices")
Signed-off-by: Yige Jiang <yigejiang86@gmail.com>
---
Based on linux-next next-20261109 (630059a5a632).
Compile-tested: arm64, GCC 14.2.0, W=1, CONFIG_FSL_FMAN=y, CONFIG_FSL_DPAA=y, CONFIG_COMPILE_TEST=y; baseline and patched mac.o, no new warnings.
No hardware or runtime test was performed.
The path needs dpaa_eth_add_device() to fail (allocation failure or a
platform_device_add() error) after the MAC was initialized.
drivers/net/ethernet/freescale/fman/mac.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/ethernet/freescale/fman/mac.c b/drivers/net/ethernet/freescale/fman/mac.c
index 29c2fa2be837..4180cec15c0f 100644
--- a/drivers/net/ethernet/freescale/fman/mac.c
+++ b/drivers/net/ethernet/freescale/fman/mac.c
@@ -307,6 +307,7 @@ static int mac_probe(struct platform_device *_of_dev)
dev_err(dev, "failed to add Ethernet platform device for MAC %d\n",
priv->cell_index);
priv->eth_dev = NULL;
+ goto _return_dev_arr_put;
}
return err;
base-commit: 630059a5a632377b9b7b487baccde92b7ae1dd47
--
2.50.1 (Apple Git-155)
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH net] fsl/fman: Drop device references when dpaa_eth_add_device() fails
2026-11-26 9:37 [PATCH net] fsl/fman: Drop device references when dpaa_eth_add_device() fails Yige Jiang
@ 2026-11-26 9:42 ` netdev-bot+sinfo
2026-11-26 11:53 ` Yige Jiang
0 siblings, 1 reply; 3+ messages in thread
From: netdev-bot+sinfo @ 2026-11-26 9:42 UTC (permalink / raw)
To: Yige Jiang
Cc: Madalin Bucur, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Sean Anderson, netdev, linux-kernel
Hi!
This is an automated message. This series looks like a fix, but its
commit messages seem to be missing some information:
- How the issue was discovered, e.g. hit in production, hit during
development, syzbot report, manual code inspection, LLM or static
analysis tool scan.
Please do not repost the series just to address the above. Instead,
reply to this email with the missing information, so that reviewers
can take it into account.
*IMPORTANT*: If you do repost (for other reasons) - please include
the relevant info in the cover letter or commit messages.
--
The evaluation is done by an LLM so it may be wrong, if you think
that is the case please reply and explain.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net] fsl/fman: Drop device references when dpaa_eth_add_device() fails
2026-11-26 9:42 ` netdev-bot+sinfo
@ 2026-11-26 11:53 ` Yige Jiang
0 siblings, 0 replies; 3+ messages in thread
From: Yige Jiang @ 2026-11-26 11:53 UTC (permalink / raw)
To: netdev-bot+sinfo
Cc: Madalin Bucur, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Sean Anderson, netdev, linux-kernel
Hi,
A static analysis warning about of_node_put() led me to look at
mac_probe(). The warning was a false positive. During an LLM-assisted
review of the surrounding error paths, I found that a failure in
dpaa_eth_add_device() bypasses the cleanup for the FMan device and
both port devices.
I compile-tested the fix on arm64 but did not reproduce the leak at
runtime.
Thanks,
Yige
> On Nov 26, 2026, at 5:42 PM, netdev-bot+sinfo@kernel.org wrote:
>
> Hi!
>
> This is an automated message. This series looks like a fix, but its
> commit messages seem to be missing some information:
>
> - How the issue was discovered, e.g. hit in production, hit during
> development, syzbot report, manual code inspection, LLM or static
> analysis tool scan.
>
> Please do not repost the series just to address the above. Instead,
> reply to this email with the missing information, so that reviewers
> can take it into account.
>
> *IMPORTANT*: If you do repost (for other reasons) - please include
> the relevant info in the cover letter or commit messages.
> --
> The evaluation is done by an LLM so it may be wrong, if you think
> that is the case please reply and explain.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-11-26 11:53 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-26 9:37 [PATCH net] fsl/fman: Drop device references when dpaa_eth_add_device() fails Yige Jiang
2026-11-26 9:42 ` netdev-bot+sinfo
2026-11-26 11:53 ` Yige Jiang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®