* [PATCH] RDMA/rvt: Fix potential memory leak caused by rvt_alloc_rq
@ 2020-06-12 19:54 Aditya Pakki
2020-06-13 17:24 ` Dennis Dalessandro
0 siblings, 1 reply; 2+ messages in thread
From: Aditya Pakki @ 2020-06-12 19:54 UTC (permalink / raw)
To: pakki001
Cc: kjlu, wu000273, Dennis Dalessandro, Mike Marciniszyn,
Doug Ledford, Jason Gunthorpe, linux-rdma, linux-kernel
In case of failure of alloc_ud_wq_attr, the memory allocated by
rvt_alloc_rq() is not freed. The patch fixes this issue by
calling rvt_free_rq().
Signed-off-by: Aditya Pakki <pakki001@umn.edu>
---
drivers/infiniband/sw/rdmavt/qp.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/infiniband/sw/rdmavt/qp.c b/drivers/infiniband/sw/rdmavt/qp.c
index 511b72809e14..17ea7da73bf9 100644
--- a/drivers/infiniband/sw/rdmavt/qp.c
+++ b/drivers/infiniband/sw/rdmavt/qp.c
@@ -1203,6 +1203,7 @@ struct ib_qp *rvt_create_qp(struct ib_pd *ibpd,
qp->s_flags = RVT_S_SIGNAL_REQ_WR;
err = alloc_ud_wq_attr(qp, rdi->dparms.node);
if (err) {
+ rvt_free_rq(&qp->r_rq);
ret = (ERR_PTR(err));
goto bail_driver_priv;
}
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] RDMA/rvt: Fix potential memory leak caused by rvt_alloc_rq
2020-06-12 19:54 [PATCH] RDMA/rvt: Fix potential memory leak caused by rvt_alloc_rq Aditya Pakki
@ 2020-06-13 17:24 ` Dennis Dalessandro
0 siblings, 0 replies; 2+ messages in thread
From: Dennis Dalessandro @ 2020-06-13 17:24 UTC (permalink / raw)
To: Aditya Pakki
Cc: kjlu, wu000273, Mike Marciniszyn, Doug Ledford, Jason Gunthorpe,
linux-rdma, linux-kernel
On 6/12/2020 3:54 PM, Aditya Pakki wrote:
> In case of failure of alloc_ud_wq_attr, the memory allocated by
> rvt_alloc_rq() is not freed. The patch fixes this issue by
> calling rvt_free_rq().
>
> Signed-off-by: Aditya Pakki <pakki001@umn.edu>
> ---
> drivers/infiniband/sw/rdmavt/qp.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/infiniband/sw/rdmavt/qp.c b/drivers/infiniband/sw/rdmavt/qp.c
> index 511b72809e14..17ea7da73bf9 100644
> --- a/drivers/infiniband/sw/rdmavt/qp.c
> +++ b/drivers/infiniband/sw/rdmavt/qp.c
> @@ -1203,6 +1203,7 @@ struct ib_qp *rvt_create_qp(struct ib_pd *ibpd,
> qp->s_flags = RVT_S_SIGNAL_REQ_WR;
> err = alloc_ud_wq_attr(qp, rdi->dparms.node);
> if (err) {
> + rvt_free_rq(&qp->r_rq);
> ret = (ERR_PTR(err));
> goto bail_driver_priv;
> }
>
This should probably use the unwind code at the end to be consistent.
Looks like the rvt_free_rq and free_ud_wq_attr have gotten out of order
and shouldn't be tied together, so that needs fixed up too.
I'd need to study the git log a little more to see what happened but I
think d310c4bf8aea ("IB/{rdmavt, hfi1, qib}: Remove AH refcount for UD
QPs") just missed this.
-Denny
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-06-13 17:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-12 19:54 [PATCH] RDMA/rvt: Fix potential memory leak caused by rvt_alloc_rq Aditya Pakki
2020-06-13 17:24 ` Dennis Dalessandro
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).