From: Jakub Kicinski <kuba@kernel.org>
To: rosenp@gmail.com
Cc: Jakub Kicinski <kuba@kernel.org>,
netdev@vger.kernel.org, andrew+netdev@lunn.ch,
linux-kernel@vger.kernel.org (open list),
edumazet@google.com, davem@davemloft.net, pabeni@redhat.com,
marcin.s.wojtas@gmail.com
Subject: Re: [net-next] net: mvneta: fix NVMEM mac address
Date: Fri, 6 Mar 2026 17:18:16 -0800 [thread overview]
Message-ID: <20260307011816.1223696-1-kuba@kernel.org> (raw)
In-Reply-To: <20260305224643.14524-1-rosenp@gmail.com>
This is an AI-generated review of your patch. The human sending this
email has considered the AI review valid, or at least plausible.
For local reproduction steps see https://netdev-ai.bots.linux.dev/ai-local.html
---
net: mvneta: fix NVMEM mac address
This commit adds handling for EPROBE_DEFER from of_get_ethdev_address()
to avoid falling back to a random MAC address when the NVMEM module loads
after the ethernet driver.
> diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
> index 9ba4aef7080c..18bc13dd4e58 100644
> --- a/drivers/net/ethernet/marvell/mvneta.c
> +++ b/drivers/net/ethernet/marvell/mvneta.c
> @@ -5620,6 +5620,8 @@ static int mvneta_probe(struct platform_device *pdev)
> }
>
> err = of_get_ethdev_address(dn, dev);
> + if (err == -EPROBE_DEFER)
> + goto err_free_ports;
Does this leak the per-CPU stats? Earlier in mvneta_probe(), stats are
allocated:
pp->stats = netdev_alloc_pcpu_stats(struct mvneta_pcpu_stats);
if (!pp->stats) {
err = -ENOMEM;
goto err_free_ports;
}
err = of_get_ethdev_address(dn, dev);
When of_get_ethdev_address() returns -EPROBE_DEFER, this code jumps to
err_free_ports which only frees pp->ports but not pp->stats.
The err_free_ports label only calls free_percpu(pp->ports) and does not
free pp->stats. Stats are only freed at the err_netdev label which is
skipped by this error path. This causes a memory leak on every deferred
probe attempt when NVMEM loads after the ethernet driver.
> if (!err) {
> mac_from = "device tree";
> } else {
--
pw-bot: cr
next prev parent reply other threads:[~2026-03-07 1:18 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-05 22:46 [PATCH net-next] net: mvneta: fix NVMEM mac address Rosen Penev
2026-03-06 17:35 ` Andrew Lunn
2026-03-07 1:18 ` Jakub Kicinski [this message]
2026-03-07 1:18 ` Jakub Kicinski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260307011816.1223696-1-kuba@kernel.org \
--to=kuba@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=marcin.s.wojtas@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rosenp@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox