i40iw: Free QP resources on CQP destroy QP failure
authorShiraz Saleem <shiraz.saleem@intel.com>
Fri, 23 Jun 2017 21:03:59 +0000 (16:03 -0500)
committerDoug Ledford <dledford@redhat.com>
Thu, 20 Jul 2017 15:20:49 +0000 (11:20 -0400)
Current flow leaves software QP structures in memory if
Control Queue Pair (CQP) destroy QP OP fails. To fix this,
free QP resources on fail of CQP destroy QP OP.

Signed-off-by: Shiraz Saleem <shiraz.saleem@intel.com>
Signed-off-by: Henry Orosco <henry.orosco@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/infiniband/hw/i40iw/i40iw_utils.c

index 56d986924a4c1708216684f776f4705451a65f79..ded8e48ed3c82788001b94d75d320f45e6a5ea58 100644 (file)
@@ -546,8 +546,12 @@ void i40iw_rem_ref(struct ib_qp *ibqp)
        cqp_info->in.u.qp_destroy.scratch = (uintptr_t)cqp_request;
        cqp_info->in.u.qp_destroy.remove_hash_idx = true;
        status = i40iw_handle_cqp_op(iwdev, cqp_request);
-       if (status)
-               i40iw_pr_err("CQP-OP Destroy QP fail");
+       if (!status)
+               return;
+
+       i40iw_rem_pdusecount(iwqp->iwpd, iwdev);
+       i40iw_free_qp_resources(iwdev, iwqp, qp_num);
+       i40iw_rem_devusecount(iwdev);
 }
 
 /**