1
0
Fork 0

RDMA/rvt: Fix potential memory leak caused by rvt_alloc_rq

In case of failure of alloc_ud_wq_attr(), the memory allocated by
rvt_alloc_rq() is not freed. Fix it by calling rvt_free_rq() using the
existing clean-up code.

Fixes: d310c4bf8a ("IB/{rdmavt, hfi1, qib}: Remove AH refcount for UD QPs")
Link: https://lore.kernel.org/r/20200614041148.131983-1-pakki001@umn.edu
Signed-off-by: Aditya Pakki <pakki001@umn.edu>
Acked-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
alistair/sunxi64-5.8
Aditya Pakki 2020-06-13 23:11:48 -05:00 committed by Jason Gunthorpe
parent 1ea7c546b8
commit 90a239ee25
1 changed files with 4 additions and 2 deletions

View File

@ -1204,7 +1204,7 @@ struct ib_qp *rvt_create_qp(struct ib_pd *ibpd,
err = alloc_ud_wq_attr(qp, rdi->dparms.node);
if (err) {
ret = (ERR_PTR(err));
goto bail_driver_priv;
goto bail_rq_rvt;
}
if (init_attr->create_flags & IB_QP_CREATE_NETDEV_USE)
@ -1314,9 +1314,11 @@ bail_qpn:
rvt_free_qpn(&rdi->qp_dev->qpn_table, qp->ibqp.qp_num);
bail_rq_wq:
rvt_free_rq(&qp->r_rq);
free_ud_wq_attr(qp);
bail_rq_rvt:
rvt_free_rq(&qp->r_rq);
bail_driver_priv:
rdi->driver_f.qp_priv_free(rdi, qp);