IB/cm: Avoid a loop when device has 255 ports
authorParav Pandit <parav@nvidia.com>
Wed, 27 Jan 2021 15:00:08 +0000 (17:00 +0200)
committerJason Gunthorpe <jgg@nvidia.com>
Tue, 2 Feb 2021 19:10:31 +0000 (15:10 -0400)
commit131be26750379592f0dd6244b2a90bbb504a10bb
treecad99a1befe84197d0cb914951088522a29580c2
parentd286ac1d05210695c312b9018b3aa7c2048e9aca
IB/cm: Avoid a loop when device has 255 ports

When RDMA device has 255 ports, loop iterator i overflows.  Due to which
cm_add_one() port iterator loops infinitely.  Use core provided port
iterator to avoid the infinite loop.

Fixes: a977049dacde ("[PATCH] IB: Add the kernel CM implementation")
Link: https://lore.kernel.org/r/20210127150010.1876121-9-leon@kernel.org
Signed-off-by: Mark Bloch <mbloch@nvidia.com>
Signed-off-by: Parav Pandit <parav@nvidia.com>
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/infiniband/core/cm.c