From patchwork Thu Oct 31 13:26:35 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eli Cohen X-Patchwork-Id: 3120521 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 1E238BF924 for ; Thu, 31 Oct 2013 13:27:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0730A203AC for ; Thu, 31 Oct 2013 13:27:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E74722045B for ; Thu, 31 Oct 2013 13:27:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754407Ab3JaN1E (ORCPT ); Thu, 31 Oct 2013 09:27:04 -0400 Received: from mail-ee0-f48.google.com ([74.125.83.48]:58462 "EHLO mail-ee0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754339Ab3JaN1D (ORCPT ); Thu, 31 Oct 2013 09:27:03 -0400 Received: by mail-ee0-f48.google.com with SMTP id d49so1354006eek.21 for ; Thu, 31 Oct 2013 06:27:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=4fvRp/iRvjxrCKiJozLh/zf4Vb/PFVW4zPEss2ed3ws=; b=kPcKPg22ENbjEmqn6FdhnWJMRxTyq+efjpJNBrQ9Pfm1Uoe/naG9M49Qt/wm2SB9lO EN/5fy6f3S3BS7CyG4niIrE8DQre4KJ/Mc7H27ioQrlYTufsgcveSISRM6NKAOn1FnNJ kxn6GIBtuLVB5FK33AuMopb1SBCjI2pTgbGUoOd7CJSgRzBUQ+TI3qPyVGhQ3OtXWEXs Gqmjxkqs1ZzBhFER8sPaSxosz24H4/LExR17Mc9yd0V7h+bJNXDA8Fzma6ARN8SKhF9c +cM61X3KMqH6zU0n0CxjlrSHsjsNCdg9ijhy8NIqcjXsuf+XtC2kALjj/pDWga7iDqrY 2byA== X-Gm-Message-State: ALoCoQnTltGNk3qGUib1Z2m45OF/RfiIZbhXA5WdSDM+/U7chgKNXFnK5oVXZvIytKFqsDgg+sLn X-Received: by 10.14.241.141 with SMTP id g13mr3202050eer.75.1383226021771; Thu, 31 Oct 2013 06:27:01 -0700 (PDT) Received: from localhost (out.voltaire.com. [193.47.165.251]) by mx.google.com with ESMTPSA id d7sm8576697eem.8.2013.10.31.06.27.00 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 31 Oct 2013 06:27:01 -0700 (PDT) From: Eli Cohen To: roland@kernel.org Cc: linux-rdma@vger.kernel.org, amirv@mellanox.com, ogerlitz@mellanox.com, yevgenyp@mellanox.com, Eli Cohen Subject: [PATCH for-next 5/6] IB/mlx4: Fix endless loop in resize CQ Date: Thu, 31 Oct 2013 15:26:35 +0200 Message-Id: <1383225996-14828-6-git-send-email-eli@mellanox.com> X-Mailer: git-send-email 1.8.4.1 In-Reply-To: <1383225996-14828-1-git-send-email-eli@mellanox.com> References: <1383225996-14828-1-git-send-email-eli@mellanox.com> Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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. Issue: 346608 Signed-off-by: Eli Cohen --- drivers/infiniband/hw/mlx4/cq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/mlx4/cq.c b/drivers/infiniband/hw/mlx4/cq.c index ea29951..66dbf80 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;