Skip to content

Commit a9d7652

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 821bb10 commit a9d7652

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

12531253
if (hns_roce_alloc_buf(&qp->buf, qp->buf_size, HNS_HW_PAGE_SIZE))
1254-
goto err_alloc;
1254+
goto err_alloc_recv_rinl_buf;
12551255

12561256
return 0;
12571257

1258-
err_alloc:
1258+
err_alloc_recv_rinl_buf:
12591259
free_recv_rinl_buf(&qp->rq_rinl_buf);
1260+
err_alloc:
12601261
if (qp->rq.wrid)
12611262
free(qp->rq.wrid);
12621263

0 commit comments

Comments
 (0)