[PATCH] cxgb4: fix FW SGE queue cleanup on remove

From: Guangshuo Li

Date: Tue Sep 15 2026 - 22:53:36 EST


init_one() allocates the FW SGE queues with setup_fw_sge_queues()
before registering the network devices.

The probe failure path releases these queues with
t4_free_sge_resources(). However, the normal removal path only calls
t4_free_sge_resources() through cxgb_down() when
CXGB4_FULL_INIT_DONE is set.

If the device is successfully probed and removed before it is fully
initialized, such as when none of its network interfaces has been
opened, CXGB4_FULL_INIT_DONE remains clear and the FW SGE queues are
left allocated.

Release any remaining FW SGE queues when removing an adapter which has
not completed full initialization.

This issue was found by manual code inspection.

Fixes: 843bd7db79c8 ("cxgb4: Setup FW queues before registering netdev")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Guangshuo Li <lgs201920130244@xxxxxxxxx>
---
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
index 1ced6df6eac8..146419c66348 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
@@ -7116,6 +7116,9 @@ static void remove_one(struct pci_dev *pdev)

if (adapter->flags & CXGB4_FULL_INIT_DONE)
cxgb_down(adapter);
+ else if (adapter->sge.fw_evtq.desc ||
+ adapter->sge.intrq.desc)
+ t4_free_sge_resources(adapter);

if (adapter->flags & CXGB4_USING_MSIX)
free_msix_info(adapter);
--
2.43.0