]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
RDMA/irdma: Initialize free_qp completion before using it
authorJacob Moroni <jmoroni@google.com>
Mon, 16 Mar 2026 18:39:38 +0000 (13:39 -0500)
committerLeon Romanovsky <leonro@nvidia.com>
Wed, 18 Mar 2026 10:20:53 +0000 (06:20 -0400)
In irdma_create_qp, if ib_copy_to_udata fails, it will call
irdma_destroy_qp to clean up which will attempt to wait on
the free_qp completion, which is not initialized yet. Fix this
by initializing the completion before the ib_copy_to_udata call.

Fixes: b48c24c2d710 ("RDMA/irdma: Implement device supported verb APIs")
Signed-off-by: Jacob Moroni <jmoroni@google.com>
Signed-off-by: Tatyana Nikolova <tatyana.e.nikolova@intel.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
drivers/infiniband/hw/irdma/verbs.c

index a20d25585993ad5ba4af450f07d8896e44478c39..ce1050bdd1919f4a3be352e45e964ce26b89ffd5 100644 (file)
@@ -1105,6 +1105,7 @@ static int irdma_create_qp(struct ib_qp *ibqp,
        spin_lock_init(&iwqp->sc_qp.pfpdu.lock);
        iwqp->sig_all = init_attr->sq_sig_type == IB_SIGNAL_ALL_WR;
        rf->qp_table[qp_num] = iwqp;
+       init_completion(&iwqp->free_qp);
 
        if (udata) {
                /* GEN_1 legacy support with libi40iw does not have expanded uresp struct */
@@ -1129,7 +1130,6 @@ static int irdma_create_qp(struct ib_qp *ibqp,
                }
        }
 
-       init_completion(&iwqp->free_qp);
        return 0;
 
 error: