blob: 0a42e1b735a525273ea0ec3d15bf61c110f5b12d [file] [log] [blame]
From 969c99cacd0ba69bcbe3e88690931d16119eeeb7 Mon Sep 17 00:00:00 2001
From: Mohamad Heib <>
Date: Wed, 2 Oct 2019 15:21:27 +0300
Subject: [PATCH] IB/core: Fix wrong iterating on ports
commit 1cbe866cbcb53338de33cf67262e73f9315a9725 upstream.
rdma_for_each_port is already incrementing the iterator's value it
receives therefore, after the first iteration the iterator is increased by
2 which eventually causing wrong queries and possible traces.
Fix the above by removing the old redundant incrementation that was used
before rdma_for_each_port() macro.
Cc: <>
Fixes: ea1075edcbab ("RDMA: Add and use rdma_for_each_port")
Signed-off-by: Mohamad Heib <>
Reviewed-by: Erez Alfasi <>
Signed-off-by: Leon Romanovsky <>
Reviewed-by: Jason Gunthorpe <>
Signed-off-by: Jason Gunthorpe <>
Signed-off-by: Paul Gortmaker <>
diff --git a/drivers/infiniband/core/security.c b/drivers/infiniband/core/security.c
index 1ab423b19f77..6eb6d2717ca5 100644
--- a/drivers/infiniband/core/security.c
+++ b/drivers/infiniband/core/security.c
@@ -426,7 +426,7 @@ int ib_create_qp_security(struct ib_qp *qp, struct ib_device *dev)
int ret;
rdma_for_each_port (dev, i) {
- is_ib = rdma_protocol_ib(dev, i++);
+ is_ib = rdma_protocol_ib(dev, i);
if (is_ib)