Skip to content

Commit 65267c9

Browse files
Erni Sri Satya VennelaPaolo Abeni
authored andcommitted
net: mana: Fix EQ leak in mana_remove on NULL port
In mana_remove(), when a NULL port is encountered in the port iteration loop, 'goto out' skips the mana_destroy_eq(ac) call, leaking the event queues allocated earlier by mana_create_eq(). This can happen when mana_probe_port() fails for port 0, leaving ac->ports[0] as NULL. On driver unload or error cleanup, mana_remove() hits the NULL entry and jumps past mana_destroy_eq(). Change 'goto out' to 'break' so the for-loop exits normally and mana_destroy_eq() is always reached. Remove the now-unreferenced out: label. Fixes: 1e2d082 ("net: mana: Add support for EQ sharing") Signed-off-by: Erni Sri Satya Vennela <ernis@linux.microsoft.com> Link: https://patch.msgid.link/20260420124741.1056179-6-ernis@linux.microsoft.com Reviewed-by: Simon Horman <horms@kernel.org> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
1 parent a7fdaf0 commit 65267c9

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

drivers/net/ethernet/microsoft/mana/mana_en.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3752,7 +3752,7 @@ void mana_remove(struct gdma_dev *gd, bool suspending)
37523752
if (!ndev) {
37533753
if (i == 0)
37543754
dev_err(dev, "No net device to remove\n");
3755-
goto out;
3755+
break;
37563756
}
37573757

37583758
apc = netdev_priv(ndev);
@@ -3783,7 +3783,7 @@ void mana_remove(struct gdma_dev *gd, bool suspending)
37833783
}
37843784

37853785
mana_destroy_eq(ac);
3786-
out:
3786+
37873787
if (ac->per_port_queue_reset_wq) {
37883788
destroy_workqueue(ac->per_port_queue_reset_wq);
37893789
ac->per_port_queue_reset_wq = NULL;

0 commit comments

Comments
 (0)