Received: by 10.213.65.68 with SMTP id h4csp421128imn; Tue, 13 Mar 2018 08:32:07 -0700 (PDT) X-Google-Smtp-Source: AG47ELty8MleY/RI66rFVRoP8+ObMx7ZTW/kNTnCiBIlPSdDz9CtWmb0WAK+BoWbvDxNemI9iJrV X-Received: by 10.98.160.90 with SMTP id r87mr988107pfe.151.1520955127337; Tue, 13 Mar 2018 08:32:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520955127; cv=none; d=google.com; s=arc-20160816; b=lez/i3wsILc+nw1qc7PkQrsawi1PV9bnaszA2RzerqrTZQtiFFfWlubkTzM3HooGzH FbrtSJ/TJvSeDi1q+g3Esh+pLMi0qi4G18iqNAF4PyXDEaFIknSp6PIIh2d3nUldzrof DRLcespZPU7qLmGg4ohwJ3RZj1ifgIJQusiRiQEhR2Gepf8eMNk4hkzQM4vGwpUtYSkE vy86+UpjqPushZEWkMApFbjAPt5xnout5XQuEm4qf+wwezg++TP9wHSgdIebU1lyuHKZ r3BHcGeLMUj1WilglMKUrtDIs0S9+kjSWPxfbGFpeFTvkuT4zZiaxy5nvdJQq11MbYU0 myFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=1JVlvTpT6CPwp2bEkVHbgAEq2CfWbfJb4n+KA8Ju0IQ=; b=sxUZP3SjGVFlsmSpKyn8WrJ8oIXkzvEwKnQwDF9MMuMBY+PYwG2cr4vV9K/fIft5OV S57d3/rJPD9pVzW7kiPHtDWRoT0Q0xLYMlYNlwGn7RdCH4x/ryj3ZRD5O2zYK1881GD3 hQbaKFQjMeysxzrTUDw7cBscjxX5VI94o7R2xU/ElBvTkcYiljo7Ns+bv8Iqp32RQd/m 3Jd2wnnSK2UQ/r9PXeTaFbpF+KIPxY+O5Iqv1qs7X4DEC2zf0k/7sm6Oix2mSU/YDyFA vObFebTmQCp0om3yp+4z9lNePyvIjA+CYrR5bLR77g6q2yx2bcN+dlN4IyCuxcGYWTtj dDhA== ARC-Authentication-Results: i=1; mx.google.com; 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 y8-v6si281356plt.378.2018.03.13.08.31.52; Tue, 13 Mar 2018 08:32:07 -0700 (PDT) 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; 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 S933213AbeCMPaQ (ORCPT + 99 others); Tue, 13 Mar 2018 11:30:16 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:58724 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752148AbeCMPaN (ORCPT ); Tue, 13 Mar 2018 11:30:13 -0400 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 7EA17504; Tue, 13 Mar 2018 15:30:12 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sergey Gorenko , Laurence Oberman , Leon Romanovsky , Jason Gunthorpe Subject: [PATCH 4.15 059/146] IB/mlx5: Fix incorrect size of klms in the memory region Date: Tue, 13 Mar 2018 16:23:46 +0100 Message-Id: <20180313152325.231930232@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180313152320.439085687@linuxfoundation.org> References: <20180313152320.439085687@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Sergey Gorenko commit da343b6d90e11132f1e917d865d88ee35d6e6d00 upstream. The value of mr->ndescs greater than mr->max_descs is set in the function mlx5_ib_sg_to_klms() if sg_nents is greater than mr->max_descs. This is an invalid value and it causes the following error when registering mr: mlx5_0:dump_cqe:276:(pid 193): dump error cqe 00000000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00000030: 00 00 00 00 0f 00 78 06 25 00 00 8b 08 1e 8f d3 Cc: # 4.5 Fixes: b005d3164713 ("mlx5: Add arbitrary sg list support") Signed-off-by: Sergey Gorenko Tested-by: Laurence Oberman Signed-off-by: Leon Romanovsky Signed-off-by: Jason Gunthorpe Signed-off-by: Greg Kroah-Hartman --- drivers/infiniband/hw/mlx5/mr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/infiniband/hw/mlx5/mr.c +++ b/drivers/infiniband/hw/mlx5/mr.c @@ -1813,7 +1813,6 @@ mlx5_ib_sg_to_klms(struct mlx5_ib_mr *mr mr->ibmr.iova = sg_dma_address(sg) + sg_offset; mr->ibmr.length = 0; - mr->ndescs = sg_nents; for_each_sg(sgl, sg, sg_nents, i) { if (unlikely(i >= mr->max_descs)) @@ -1825,6 +1824,7 @@ mlx5_ib_sg_to_klms(struct mlx5_ib_mr *mr sg_offset = 0; } + mr->ndescs = i; if (sg_offset_p) *sg_offset_p = sg_offset;