aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoland Dreier <roland@purestorage.com>2013-11-15 10:24:08 -0800
committerRoland Dreier <roland@purestorage.com>2013-11-15 10:24:08 -0800
commit65585f680dc08d45d05f82320aab52c3d3221e82 (patch)
tree0e31503bfac56e067a355ee9b7fc01e3cfb0d928
parentbac599fc367bfb1313cc3e203112832eada818f3 (diff)
downloadlibmlx4-65585f680dc08d45d05f82320aab52c3d3221e82.tar.gz
resize_cq: Fix possible endless loop scanning CQ
When calling get_sw_cqe() we need pass the consumer_index and not the masked value. Failure to do so will cause incorrect result of get_sw_cqe() possibly leading to endless loop. Based on a patch by Eli Cohen <eli@dev.mellanox.co.il> fixing the same bug in the kernel. Signed-off-by: Roland Dreier <roland@purestorage.com>
-rw-r--r--src/cq.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/cq.c b/src/cq.c
index 18447c4..bd9bf0f 100644
--- a/src/cq.c
+++ b/src/cq.c
@@ -439,7 +439,7 @@ int mlx4_get_outstanding_cqes(struct mlx4_cq *cq)
{
uint32_t i;
- for (i = cq->cons_index; get_sw_cqe(cq, (i & cq->ibv_cq.cqe)); ++i)
+ for (i = cq->cons_index; get_sw_cqe(cq, i); ++i)
;
return i - cq->cons_index;