From: Eli Cohen Date: Thu, 31 Oct 2013 13:26:35 +0000 (+0200) Subject: IB/mlx4: Fix endless loop in resize CQ X-Git-Tag: firefly_0821_release~176^2~4931^2^6 X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=93b80ac297b1cfdf3bea771a5ce6ea4ff5d25d1d;p=firefly-linux-kernel-4.4.55.git IB/mlx4: Fix endless loop in resize 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. This problem was reported and analyzed by Michael Rice from HP. Signed-off-by: Eli Cohen Signed-off-by: Roland Dreier --- diff --git a/drivers/infiniband/hw/mlx4/cq.c b/drivers/infiniband/hw/mlx4/cq.c index d5e60f44ba5a..3fe1a68a500a 100644 --- a/drivers/infiniband/hw/mlx4/cq.c +++ b/drivers/infiniband/hw/mlx4/cq.c @@ -324,7 +324,7 @@ static int mlx4_ib_get_outstanding_cqes(struct mlx4_ib_cq *cq) u32 i; i = cq->mcq.cons_index; - while (get_sw_cqe(cq, i & cq->ibcq.cqe)) + while (get_sw_cqe(cq, i)) ++i; return i - cq->mcq.cons_index;