Received: by 10.213.65.68 with SMTP id h4csp433362imn; Tue, 13 Mar 2018 08:55:31 -0700 (PDT) X-Google-Smtp-Source: AG47ELvC6fSaKzG2orjfDVWC5jkj2GlVwwdUTyguodP78Wrj69yV0cik3oRlh/EbsPJ3TbqM28gg X-Received: by 10.99.149.15 with SMTP id p15mr907275pgd.154.1520956531803; Tue, 13 Mar 2018 08:55:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520956531; cv=none; d=google.com; s=arc-20160816; b=oDWQqAUASneshJsA9XWcP+3lyll70sPH0K/ureR7PsHOZ0JRRJYmMHtdOUknV3WQTf VxROE4m0g2il/si6ymTuoqzqXwV3Xrb4uHRnLT6h47kIIjCzOuozQiwLNf24PUW9S2hw Gh7rbxG+1T1AKnkxVM3+QsLSm0l2wGhT4qVbddvdWs6+vBZkB73llhG5SyeB2NhZZ1Qh nu65Ek84UdU3xJiOUB+sAtGhoJbZ2bdOqlbvW0RiYcQV8nZQLnjP0cm2hKbQa+VDCIpF xmIF8ZH3WwANe0MSfBtBdjhIi5fRsKXWUaS09QU/sQAMSf078QcygLhY29b28bLyETDh iGPA== 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=yS82jN29y5PYxT0Q8sQIuKCBbSxAewLnLPli8ck7CU4=; b=gu6Oh+hP9RPVKnYUgFm5HvdrcUMorA2VaqWrJjTvq3/N1q2P9nvHD6531ItxZoJMsI fzFhXsy93RRJItEp4lmVoQ+elmRSbAu7H2snJ15Dpajdj2dzvYnUserIdHdW54R7wGPD jffpAWX8+5rDlG5yaeFDKr6oogFML2vm6oovdlYzTsNgyLo5WU31kq26PoKsJ8BMQ3eB aWOVrG0DmY69HIJ4yZ0FGz/yswWBsEtJWg6gkxzDt5E43uFFovmcRC1U1t0BfU+5QpyD jOzzsC91zhJRdAI1/wWd3Wgvax8Y6kB6WRWGLCXS3LEQG7Dx2DHciqMkJYDzBc7kXIlg Svpg== 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 y22si288060pfm.357.2018.03.13.08.55.16; Tue, 13 Mar 2018 08:55:31 -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 S934740AbeCMPja (ORCPT + 99 others); Tue, 13 Mar 2018 11:39:30 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:35330 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934680AbeCMPj1 (ORCPT ); Tue, 13 Mar 2018 11:39:27 -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 A528FFCF; Tue, 13 Mar 2018 15:39:26 +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.14 094/140] IB/mlx5: Fix incorrect size of klms in the memory region Date: Tue, 13 Mar 2018 16:24:57 +0100 Message-Id: <20180313152504.485294946@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180313152458.201155692@linuxfoundation.org> References: <20180313152458.201155692@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.14-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;