Skip to contentSkip to conversation

net/mana: Null service_wq on setup error to prevent double destroy

PATCH Applied Konstantin Taranov 3 participants 3 messages Mar 9 – Mar 12

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/mana: Null service_wq on setup error to prevent double destroy

From: Shiraz Saleem <[email protected]>

In mana_gd_setup() error path, set gc->service_wq to NULL after destroy_workqueue() to match the cleanup in mana_gd_cleanup(). This prevents a use-after-free if the workqueue pointer is checked after a failed setup.

Fixes f975a0955276 ("net: mana: Fix double destroy_workqueue on service rescan PCI path")
---
 drivers/net/ethernet/microsoft/mana/gdma_main.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/ethernet/microsoft/mana/gdma_main.c +1 -0
index 0055c23..e879344 100644
@@ -1934,6 +1934,7 @@ remove_irq:
 	mana_gd_remove_irqs(pdev);
 free_workqueue:
 	destroy_workqueue(gc->service_wq);
+	gc->service_wq = NULL;
 	dev_err(&pdev->dev, "%s failed (error %d)\n", __func__, err);
 	return err;
 }
Signature · 1 line
2.43.0
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Konstantin Taranov

From: Shiraz Saleem <[email protected]>

In mana_gd_setup() error path, set gc->service_wq to NULL after destroy_workqueue() to match the cleanup in mana_gd_cleanup(). This prevents a use-after-free if the workqueue pointer is checked after a failed setup.

Fixes f975a0955276 ("net: mana: Fix double destroy_workqueue on service rescan PCI path")
#2 lore raw
In reply to Konstantin Taranov
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:

Quoted 8 lines · On Mon, 9 Mar 2026 10:24:43 -0700 you wrote:

From: Shiraz Saleem <[email protected]>

In mana_gd_setup() error path, set gc->service_wq to NULL after destroy_workqueue() to match the cleanup in mana_gd_cleanup(). This prevents a use-after-free if the workqueue pointer is checked after a failed setup.

[...]

Here is the summary with links:
- [net] net/mana: Null service_wq on setup error to prevent double destroy

    https://git.kernel.org/netdev/net/c/87c2302813ab

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html