From 65585f680dc08d45d05f82320aab52c3d3221e82 Mon Sep 17 00:00:00 2001 From: Roland Dreier Date: Fri, 15 Nov 2013 10:24:08 -0800 Subject: 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 fixing the same bug in the kernel. Signed-off-by: Roland Dreier --- src/cq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; -- cgit 1.2.3-korg