Skip to content

Commit 9cbd11f

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 ea6b3ac commit 9cbd11f

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

12131213
if (hns_roce_alloc_buf(&qp->buf, qp->buf_size, HNS_HW_PAGE_SIZE))
1214-
goto err_alloc;
1214+
goto err_alloc_recv_rinl_buf;
12151215

12161216
return 0;
12171217

1218-
err_alloc:
1218+
err_alloc_recv_rinl_buf:
12191219
free_recv_rinl_buf(&qp->rq_rinl_buf);
1220+
err_alloc:
12201221
if (qp->rq.wrid)
12211222
free(qp->rq.wrid);
12221223

0 commit comments

Comments
 (0)