Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp3697151ybv; Mon, 10 Feb 2020 04:54:44 -0800 (PST) X-Google-Smtp-Source: APXvYqxe5HaIlGrI7viAGre5fdMkwXaSoBFklm9e++Myx7jTIEXbFrzoiPyrL/E7C3pFSeL31k0E X-Received: by 2002:aca:c70b:: with SMTP id x11mr736866oif.29.1581339284143; Mon, 10 Feb 2020 04:54:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581339284; cv=none; d=google.com; s=arc-20160816; b=N/Wp/G4kC3s1kTBy1J5YSMqYubwMH9pkWJxmt+rwtlEFtnSHzihlD57GLae/mk+dX6 v9rNQCYm7LfcLfMTlRoK7oClVAMRuswh6oaTWgJaxjkW+6+iuLjJJoafKRi/nOBFQzlt W1spsp/GkkQqwWyS1g8vtSS71gr1xeNNnu60oBWeDSnJSZ0Hu6RfyWPDIWqXEefKMIgP EYPyMGAHF3adFEtXY1VwExGuTxQzClT8SyWb3NP9TsQYcvujyb4hlYnVpWklJj0+egTQ bhY+JZIDsErrDRTXzaPRPsru6AVVPIhlgPr6QeVZRbNBYXm8a6N3ZUcs85+uX95Mb/dG 8JzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=jqgrrnNGsZTp+8q56KtYeBiN2a9BqwUQ2yK2DnlSLyk=; b=FI556k8dfWpolp8dYYRsVNGAItfPe8rQsdgMlI9Y+xPOwDUgF+yXKx1NzHh+u9QeCZ uvPeTw1+GiPITk1Hn5U97cvRmXZOanE6N2t6KWSIDein1/PaCF1wWJ4c0W+YCNZoyHZh Vja1B5vg1zv2vlc0CojmPMYHclcIw/X5n5IRD111xNquGXYI7F38c36TM+mdkWF/AIug sDgZHfQ/4yi16HQGdaCOkXztR0Mxcjstm7fbLTDW8dHoedJ1blL5nneYbJDB8V/9Scr1 Cel+MWmEd9fSyqiCi/MhuW+EVwIj+qGYcq6vRaiBahFt193XHf+rgMSH5hKwJOJVLvsV Q3jw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=jT6sazRm; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l131si126323oig.120.2020.02.10.04.54.32; Mon, 10 Feb 2020 04:54:44 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=jT6sazRm; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729950AbgBJMyY (ORCPT + 99 others); Mon, 10 Feb 2020 07:54:24 -0500 Received: from mail.kernel.org ([198.145.29.99]:45530 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730126AbgBJMmB (ORCPT ); Mon, 10 Feb 2020 07:42:01 -0500 Received: from localhost (unknown [209.37.97.194]) (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 C56A92051A; Mon, 10 Feb 2020 12:42:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581338520; bh=W6R6/H9LJYmDqr1OCcfQ0aOFtqfURjgqrU8o3+YAPoE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jT6sazRmjXyiwMwbG9cSAPds7K5kW/HfS1uuZQiwDjdKPS2aUD6/ekSMPYQSkVitc vlCRjt/HqiFuv6Iwcz9Ptea+svIfJw2rppXwGbt6qivVumUkNO/tP76H77vCXHq0XO UP382DaByBlG/5MM1zuQHTbdZJoUoO5WIPb1FTT4= 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 5.5 294/367] IB/mlx5: Fix outstanding_pi index for GSI qps Date: Mon, 10 Feb 2020 04:33:27 -0800 Message-Id: <20200210122450.870636011@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200210122423.695146547@linuxfoundation.org> References: <20200210122423.695146547@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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);