Skip to content

Commit bb9cb36

Browse files
jgunthorpegregkh
authored andcommitted
RDMA/mana: Fix mana_destroy_wq_obj() cleanup in mana_ib_create_qp_rss()
commit 34ecf79 upstream. Sashiko points out there are two bugs here in the error unwind flow, both related to how the WQ table is unwound. First there is a double i-- on the first failure path due to the while loop having a i--, remove it. Second if mana_ib_install_cq_cb() fails then mana_create_wq_obj() is not undone due to the above i--. Cc: stable@vger.kernel.org Fixes: c15d780 ("RDMA/mana_ib: Add CQ interrupt support for RAW QP") Link: https://sashiko.dev/#/patchset/0-v2-1c49eeb88c48%2B91-rdma_udata_rep_jgg%40nvidia.com?part=1 Link: https://patch.msgid.link/r/6-v1-41f3135e5565+9d2-rdma_ai_fixes1_jgg@nvidia.com Reviewed-by: Long Li <longli@microsoft.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent ab64c63 commit bb9cb36

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

  • drivers/infiniband/hw/mana

drivers/infiniband/hw/mana/qp.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -194,11 +194,8 @@ static int mana_ib_create_qp_rss(struct ib_qp *ibqp, struct ib_pd *pd,
194194

195195
ret = mana_create_wq_obj(mpc, mpc->port_handle, GDMA_RQ,
196196
&wq_spec, &cq_spec, &wq->rx_object);
197-
if (ret) {
198-
/* Do cleanup starting with index i-1 */
199-
i--;
197+
if (ret)
200198
goto fail;
201-
}
202199

203200
/* The GDMA regions are now owned by the WQ object */
204201
wq->queue.gdma_region = GDMA_INVALID_DMA_REGION;
@@ -218,8 +215,10 @@ static int mana_ib_create_qp_rss(struct ib_qp *ibqp, struct ib_pd *pd,
218215

219216
/* Create CQ table entry */
220217
ret = mana_ib_install_cq_cb(mdev, cq);
221-
if (ret)
218+
if (ret) {
219+
mana_destroy_wq_obj(mpc, GDMA_RQ, wq->rx_object);
222220
goto fail;
221+
}
223222
}
224223
resp.num_entries = i;
225224

0 commit comments

Comments
 (0)