]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
net: mana: initialize gdma queue id to INVALID_QUEUE_ID
authorAditya Garg <gargaditya@linux.microsoft.com>
Mon, 8 Jun 2026 10:13:40 +0000 (03:13 -0700)
committerJakub Kicinski <kuba@kernel.org>
Sat, 13 Jun 2026 00:26:05 +0000 (17:26 -0700)
mana_gd_create_mana_wq_cq() leaves queue->id as 0 (from kzalloc_obj())
until mana_create_wq_obj() assigns the firmware-returned id. If creation
fails before that, cleanup calls mana_gd_destroy_cq() with id 0, NULLing
gc->cq_table[0] and silently breaking whichever real CQ owns that slot.

Initialize queue->id to INVALID_QUEUE_ID right after allocation, matching
mana_gd_create_eq(). The existing (id >= max_num_cqs) guard then
short-circuits cleanly.

Fixes: ca9c54d2d6a5 ("net: mana: Add a driver for Microsoft Azure Network Adapter (MANA)")
Signed-off-by: Aditya Garg <gargaditya@linux.microsoft.com>
Reviewed-by: Dipayaan Roy <dipayanroy@linux.microsoft.com>
Reviewed-by: Haiyang Zhang <haiyangz@microsoft.com>
Link: https://patch.msgid.link/20260608101345.2267320-2-gargaditya@linux.microsoft.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/microsoft/mana/gdma_main.c

index d8e816882f02c2e90d02f5d700a8235aed02cd73..ac71ca8450bf4376e73dd1c7edd6edfd790e554c 100644 (file)
@@ -1192,6 +1192,8 @@ int mana_gd_create_mana_wq_cq(struct gdma_dev *gd,
        if (!queue)
                return -ENOMEM;
 
+       queue->id = INVALID_QUEUE_ID;
+
        gmi = &queue->mem_info;
        err = mana_gd_alloc_memory(gc, spec->queue_size, gmi);
        if (err) {