IB/mlx4: Fix endless loop in resize CQ
authorEli Cohen <eli@dev.mellanox.co.il>
Thu, 31 Oct 2013 13:26:35 +0000 (15:26 +0200)
committerRoland Dreier <roland@purestorage.com>
Fri, 15 Nov 2013 18:24:17 +0000 (10:24 -0800)
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 <eli@mellanox.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
drivers/infiniband/hw/mlx4/cq.c

index d5e60f44ba5ad7c4f5ad53d7e0fe348248ed797b..3fe1a68a500ac0fe490bcbe352f4ff8c4c22f1b9 100644 (file)
@@ -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;