From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C0FA9C2BA83 for ; Thu, 13 Feb 2020 15:55:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9917024681 for ; Thu, 13 Feb 2020 15:55:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581609353; bh=W6R6/H9LJYmDqr1OCcfQ0aOFtqfURjgqrU8o3+YAPoE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=iim1zJUicKjbGqJBN9WQFDl2WlHFRqQ5tPCzNkhn9PKrds4Icc57sDb0fmmIGxvGb x9/Gz8jte9U8/ZMZSnKZ6tB/lSzWn2T6sg60OVEOBFO5oSnyaoAVQxnkBkiudM6RLI f+dvShQdMRZALKCzL0/0fgI8cUHcWHp1f9NanNew= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728297AbgBMPzv (ORCPT ); Thu, 13 Feb 2020 10:55:51 -0500 Received: from mail.kernel.org ([198.145.29.99]:41422 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387444AbgBMPZc (ORCPT ); Thu, 13 Feb 2020 10:25:32 -0500 Received: from localhost (unknown [104.132.1.104]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id DD79B20848; Thu, 13 Feb 2020 15:25:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581607532; bh=W6R6/H9LJYmDqr1OCcfQ0aOFtqfURjgqrU8o3+YAPoE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mo7SDmIIdxPewhHlBZF9jlFpjpsXTv9RV43xP4CSAmqQQPpHWyhb/H/JEg1YGtcKI LyMKQ2Hec5zcX1JwF/HsaoWolPBJ26o8TQBTDmzssqtTDcqujPKBL04r8uXj4sAUOs 85bypO2ScrnQLCPbd+t+LSzyzsCdUYR9fFpm4sEE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Prabhath Sajeepa , Leon Romanovsky , Jason Gunthorpe Subject: [PATCH 4.14 104/173] IB/mlx5: Fix outstanding_pi index for GSI qps Date: Thu, 13 Feb 2020 07:20:07 -0800 Message-Id: <20200213151958.929420153@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200213151931.677980430@linuxfoundation.org> References: <20200213151931.677980430@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Prabhath Sajeepa commit b5671afe5e39ed71e94eae788bacdcceec69db09 upstream. Commit b0ffeb537f3a ("IB/mlx5: Fix iteration overrun in GSI qps") changed the way outstanding WRs are tracked for the GSI QP. But the fix did not cover the case when a call to ib_post_send() fails and updates index to track outstanding. Since the prior commmit outstanding_pi should not be bounded otherwise the loop generate_completions() will fail. Fixes: b0ffeb537f3a ("IB/mlx5: Fix iteration overrun in GSI qps") Link: https://lore.kernel.org/r/1576195889-23527-1-git-send-email-psajeepa@purestorage.com Signed-off-by: Prabhath Sajeepa Acked-by: Leon Romanovsky Signed-off-by: Jason Gunthorpe Signed-off-by: Greg Kroah-Hartman --- drivers/infiniband/hw/mlx5/gsi.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/drivers/infiniband/hw/mlx5/gsi.c +++ b/drivers/infiniband/hw/mlx5/gsi.c @@ -507,8 +507,7 @@ int mlx5_ib_gsi_post_send(struct ib_qp * ret = ib_post_send(tx_qp, &cur_wr.wr, bad_wr); if (ret) { /* Undo the effect of adding the outstanding wr */ - gsi->outstanding_pi = (gsi->outstanding_pi - 1) % - gsi->cap.max_send_wr; + gsi->outstanding_pi--; goto err; } spin_unlock_irqrestore(&gsi->lock, flags);