]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
net: mana: Skip WQ object destruction for uninitialized RXQ
authorDipayaan Roy <dipayanroy@linux.microsoft.com>
Thu, 30 Apr 2026 03:57:53 +0000 (20:57 -0700)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 5 May 2026 10:16:23 +0000 (12:16 +0200)
In mana_destroy_rxq(), mana_destroy_wq_obj() is called unconditionally
even when the WQ object was never created (rxobj is still
INVALID_MANA_HANDLE). When mana_create_rxq() fails before
mana_create_wq_obj() succeeds, the error path calls mana_destroy_rxq()
which sends a bogus destroy command to the hardware:

    mana 7870:00:00.0: HWC: Failed hw_channel req: 0x1d
    mana 7870:00:00.0: Failed to send mana message: -71, 0x1d
    mana 7870:00:00.0 eth7: Failed to destroy WQ object: -71

Guard mana_destroy_wq_obj() with an INVALID_MANA_HANDLE check so that
mana_destroy_rxq() is safe to call at any stage of RXQ initialization.

Fixes: ca9c54d2d6a5 ("net: mana: Add a driver for Microsoft Azure Network Adapter (MANA)")
Reviewed-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Dipayaan Roy <dipayanroy@linux.microsoft.com>
Link: https://patch.msgid.link/20260430035935.1859220-3-dipayanroy@linux.microsoft.com
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/net/ethernet/microsoft/mana/mana_en.c

index dfb4ba9f7664c14a476174552dfb79b81bde94cb..f2a6ea162dc31905a11bc2c5c61a80701db89f28 100644 (file)
@@ -2524,7 +2524,8 @@ static void mana_destroy_rxq(struct mana_port_context *apc,
        if (xdp_rxq_info_is_reg(&rxq->xdp_rxq))
                xdp_rxq_info_unreg(&rxq->xdp_rxq);
 
-       mana_destroy_wq_obj(apc, GDMA_RQ, rxq->rxobj);
+       if (rxq->rxobj != INVALID_MANA_HANDLE)
+               mana_destroy_wq_obj(apc, GDMA_RQ, rxq->rxobj);
 
        mana_deinit_cq(apc, &rxq->rx_cq);