Linux kernel -stable discussions
 help / color / mirror / Atom feed
* [PATCH 6.6.y] net: mana: Fix EQ leak in mana_remove on NULL port
@ 2026-08-18 23:25 Hamza Mahfooz
  2026-08-20  4:19 ` Sasha Levin
  0 siblings, 1 reply; 2+ messages in thread
From: Hamza Mahfooz @ 2026-08-18 23:25 UTC (permalink / raw)
  To: stable
  Cc: Greg Kroah-Hartman, Sasha Levin, Erni Sri Satya Vennela,
	Simon Horman, Paolo Abeni, Hamza Mahfooz

From: Erni Sri Satya Vennela <ernis@linux.microsoft.com>

[ Upstream commit 65267c9c4f28199985505977bc2c628c82fc50ef ]

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: 1e2d0824a9c3 ("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>
[ hmahfooz: resolve conflict in mana_remove() due to missing commit
  3b194343c250 ("net: mana: Implement ndo_tx_timeout and serialize
  queue resets per port.") ]
Signed-off-by: Hamza Mahfooz <hamzamahfooz@linux.microsoft.com>
---
 drivers/net/ethernet/microsoft/mana/mana_en.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/microsoft/mana/mana_en.c b/drivers/net/ethernet/microsoft/mana/mana_en.c
index 6aaf646a6307..2b0759b02c7b 100644
--- a/drivers/net/ethernet/microsoft/mana/mana_en.c
+++ b/drivers/net/ethernet/microsoft/mana/mana_en.c
@@ -3442,7 +3442,7 @@ void mana_remove(struct gdma_dev *gd, bool suspending)
 		if (!ndev) {
 			if (i == 0)
 				dev_err(dev, "No net device to remove\n");
-			goto out;
+			break;
 		}
 
 		/* All cleanup actions should stay after rtnl_lock(), otherwise
@@ -3470,7 +3470,7 @@ void mana_remove(struct gdma_dev *gd, bool suspending)
 	}
 
 	mana_destroy_eq(ac);
-out:
+
 	mana_gd_deregister_device(gd);
 
 	if (suspending)
-- 
2.55.0


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

* Re: [PATCH 6.6.y] net: mana: Fix EQ leak in mana_remove on NULL port
  2026-08-18 23:25 [PATCH 6.6.y] net: mana: Fix EQ leak in mana_remove on NULL port Hamza Mahfooz
@ 2026-08-20  4:19 ` Sasha Levin
  0 siblings, 0 replies; 2+ messages in thread
From: Sasha Levin @ 2026-08-20  4:19 UTC (permalink / raw)
  To: stable
  Cc: Sasha Levin, Greg Kroah-Hartman, Erni Sri Satya Vennela,
	Simon Horman, Paolo Abeni, Hamza Mahfooz

On Tue, Aug 18, 2026 at 07:25:31PM -0400, Hamza Mahfooz wrote:
> [ Upstream commit 65267c9c4f28199985505977bc2c628c82fc50ef ]

Queued for 6.12 and 6.6, thanks - 6.12 is missing it too and your conflict
resolution applies there unchanged, so it gets the same patch.

-- 
Thanks,
Sasha

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

end of thread, other threads:[~2026-08-20  4:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-18 23:25 [PATCH 6.6.y] net: mana: Fix EQ leak in mana_remove on NULL port Hamza Mahfooz
2026-08-20  4:19 ` Sasha Levin

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