Skip to content

Commit b75951f

Browse files
wenglianfanmorey
authored andcommitted
libhns: Fix double-free of rinl buf->wqe list
[ Upstream commit 4fe94ae ] rinl_buf->wqe_list will be double-freed in error flow, first in alloc_recv_rinl_buf() and then in free_recv_rinl_buf(). Actually free_recv_rinl_buf() shouldn't be called when alloc_recv_rinl_buf() failed. Fixes: 83b0baf ("libhns: Refactor rq inline") Signed-off-by: wenglianfa <[email protected]> Signed-off-by: Junxian Huang <[email protected]> Signed-off-by: Nicolas Morey <[email protected]>
1 parent d235a3a commit b75951f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

providers/hns/hns_roce_u_verbs.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1001,12 +1001,13 @@ static int qp_alloc_wqe(struct ibv_qp_cap *cap, struct hns_roce_qp *qp,
10011001
}
10021002

10031003
if (hns_roce_alloc_buf(&qp->buf, qp->buf_size, HNS_HW_PAGE_SIZE))
1004-
goto err_alloc;
1004+
goto err_alloc_recv_rinl_buf;
10051005

10061006
return 0;
10071007

1008-
err_alloc:
1008+
err_alloc_recv_rinl_buf:
10091009
free_recv_rinl_buf(&qp->rq_rinl_buf);
1010+
err_alloc:
10101011
if (qp->rq.wrid)
10111012
free(qp->rq.wrid);
10121013

0 commit comments

Comments
 (0)