>
> 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: [email protected]
> Fixes: c15d7802a424 ("RDMA/mana_ib: Add CQ interrupt support for RAW QP")
> Link:
> https://sashiko.d/
> ev%2F%23%2Fpatchset%2F0-v2-1c49eeb88c48%252B91-
> rdma_udata_rep_jgg%2540nvidia.com%3Fpart%3D1&data=05%7C02%7Clongli%
> 40microsoft.com%7Cd4d57c89064d4cc1781e08dea541b72a%7C72f988bf86f141
> af91ab2d7cd011db47%7C1%7C0%7C639129898849523924%7CUnknown%7CT
> WFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4
> zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=hbczVL%2F
> QTqw5zawJJPpSNkjtDrBOJNkV5Qn9vGGYbhE%3D&reserved=0
> Signed-off-by: Jason Gunthorpe <[email protected]>

Reviewed-by: Long Li <[email protected]>


> ---
>  drivers/infiniband/hw/mana/qp.c | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/infiniband/hw/mana/qp.c b/drivers/infiniband/hw/mana/qp.c
> index f7bb0d1f0f8034..8e1f052d0ec976 100644
> --- a/drivers/infiniband/hw/mana/qp.c
> +++ b/drivers/infiniband/hw/mana/qp.c
> @@ -176,11 +176,8 @@ static int mana_ib_create_qp_rss(struct ib_qp *ibqp,
> struct ib_pd *pd,
>
>               ret = mana_create_wq_obj(mpc, mpc->port_handle, GDMA_RQ,
>                                        &wq_spec, &cq_spec, &wq-
> >rx_object);
> -             if (ret) {
> -                     /* Do cleanup starting with index i-1 */
> -                     i--;
> +             if (ret)
>                       goto fail;
> -             }
>
>               /* The GDMA regions are now owned by the WQ object */
>               wq->queue.gdma_region = GDMA_INVALID_DMA_REGION; @@
> -200,8 +197,10 @@ static int mana_ib_create_qp_rss(struct ib_qp *ibqp, struct
> ib_pd *pd,
>
>               /* Create CQ table entry */
>               ret = mana_ib_install_cq_cb(mdev, cq);
> -             if (ret)
> +             if (ret) {
> +                     mana_destroy_wq_obj(mpc, GDMA_RQ, wq-
> >rx_object);
>                       goto fail;
> +             }
>       }
>       resp.num_entries = i;
>
> --
> 2.43.0


Reply via email to