Skip to content

Commit 50d48c0

Browse files
wenglianfaztefuyan
authored andcommitted
libhns: Fix double-free of rinl buf->wqe list
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: ztefuyan <[email protected]>
1 parent 62f6102 commit 50d48c0

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
@@ -1256,12 +1256,13 @@ static int qp_alloc_wqe(struct ibv_qp_cap *cap, struct hns_roce_qp *qp,
12561256
}
12571257

12581258
if (hns_roce_alloc_buf(&qp->buf, qp->buf_size, HNS_HW_PAGE_SIZE))
1259-
goto err_alloc;
1259+
goto err_alloc_recv_rinl_buf;
12601260

12611261
return 0;
12621262

1263-
err_alloc:
1263+
err_alloc_recv_rinl_buf:
12641264
free_recv_rinl_buf(&qp->rq_rinl_buf);
1265+
err_alloc:
12651266
if (qp->rq.wrid)
12661267
free(qp->rq.wrid);
12671268

0 commit comments

Comments
 (0)