File libmlx4-resize_cq-Fix-possible-endless-loop-scanning-CQ.patch of Package libmlx4-rdmav2
From 65585f680dc08d45d05f82320aab52c3d3221e82 Mon Sep 17 00:00:00 2001
From: Roland Dreier <roland@purestorage.com>
Date: Fri, 15 Nov 2013 10:24:08 -0800
Subject: [PATCH 1/4] 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>
---
src/cq.c | 2 +-
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;
--
1.7.8.2