]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
RDMA/mlx5: Fix mkey creation error flow rollback
authorMichael Guralnik <michaelgur@nvidia.com>
Wed, 10 Jun 2026 00:01:37 +0000 (03:01 +0300)
committerJason Gunthorpe <jgg@nvidia.com>
Thu, 11 Jun 2026 18:36:08 +0000 (15:36 -0300)
Fix the indices of mkeys destroyed in case of an error in batch mkey
creation.

Fixes: 36680ef7bceb ("RDMA/mlx5: Switch from MR cache to FRMR pools")
Link: https://patch.msgid.link/r/20260610000145.820592-2-michaelgur@nvidia.com
Signed-off-by: Michael Guralnik <michaelgur@nvidia.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/infiniband/hw/mlx5/mr.c

index 14c1aec1edbbc525b4be14f194a51f43bc236940..a0f23339387b354a8e13c537dfbf5f60c4409de4 100644 (file)
@@ -294,7 +294,7 @@ static int mlx5r_create_mkeys(struct ib_device *device, struct ib_frmr_key *key,
 free_in:
        kfree(in);
        if (err)
-               for (; i > 0; i--)
+               for (i--; i >= 0; i--)
                        mlx5_core_destroy_mkey(dev->mdev, handles[i]);
        return err;
 }