Thread (4 messages) 4 messages, 3 authors, 2026-03-07

Re: [net-next] net: mvneta: fix NVMEM mac address

From: Jakub Kicinski <kuba@kernel.org>
Date: 2026-03-07 01:18:18
Also in: lkml

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.
quoted hunk ↗ jump to hunk
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help