Skip to content

Commit 9a05a67

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 30e8a2f commit 9a05a67

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
@@ -193,11 +193,8 @@ static int mana_ib_create_qp_rss(struct ib_qp *ibqp, struct ib_pd *pd,
193193

194194
ret = mana_create_wq_obj(mpc, mpc->port_handle, GDMA_RQ,
195195
&wq_spec, &cq_spec, &wq->rx_object);
196-
if (ret) {
197-
/* Do cleanup starting with index i-1 */
198-
i--;
196+
if (ret)
199197
goto fail;
200-
}
201198

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

218215
/* Create CQ table entry */
219216
ret = mana_ib_install_cq_cb(mdev, cq);
220-
if (ret)
217+
if (ret) {
218+
mana_destroy_wq_obj(mpc, GDMA_RQ, wq->rx_object);
221219
goto fail;
220+
}
222221
}
223222
resp.num_entries = i;
224223

0 commit comments

Comments
 (0)