Received: by 10.213.65.68 with SMTP id h4csp523230imn; Fri, 16 Mar 2018 10:19:25 -0700 (PDT) X-Google-Smtp-Source: AG47ELvrRS5kp8ZkYskUoQ1eYGHiW9ofR2OHK/5EtwAij1lywhriOzmx8YcVHZW4L0ETvYS3qWow X-Received: by 10.99.163.1 with SMTP id s1mr2089838pge.47.1521220765481; Fri, 16 Mar 2018 10:19:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521220765; cv=none; d=google.com; s=arc-20160816; b=Ozo5p1eb+ykGpJrBZyRmYrjxmX5Faz4H8+yhDKGgbsR/aDcwj9dKVuXl0hPkPaZyP5 zajDyNc0xvoxYlRYLJDBD3Er5nZ9nwoAm/A+w9YMRCghS8xLE7Ih3ZwjpmcxyyWcJuAx uXgK1Rqy4BQqBjr19AjPmPfa/Zj3nJ46T99fJMoekedEfCh63nLWgkT1c3zVpq5p/xgD 8d8ZkvadQYbmJY7ed4UTEPXLZ9laQexaQyRrh5PnwZjAkl4lKzYd2fclW9ppXCp6kK6L 967Y6ovXGdFwrr82xMKDLR4RaNBAPFjEgmXgFbDu7iKLRCltHa7A/ezNbEU7HuVpEr91 dmlg== 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=t0VXFtpL9oDcGvkg4hZWl1DVl3U0oe4CYbfnLGK5rcc=; b=Rtf55PFhVtU6um+Ow7LSyF8REbIPwTc5My5K/sMJtebEDxrijxEWwz4g0FmHOTZlCO aZa/NZ1ocLdecqQkJnyeUa12YcDQIz2nL3z6Fk1FYisowrFvKS5mHAH888mBNberZWt8 GFOtQCtNdFFOwsMVKVhiE4I1TWlvkZ/qq8g+Z/EVYNQeEG7RBBXVNhgFS8o1DaXGUoDe XeY2Ah0JajTSPIVh17S6Dx6RoPLms9VVz8IKc/gm6VfzPZYAYRMfwQq8G6bt42MVuF2N Vb0jgrsoL/x4nzMVfEBzlR3Zlf3VJjlN41K8uuHjDXODvqVILZEMPPzCf0UN+/0MH7U0 blMA== 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 c14si5080562pgu.341.2018.03.16.10.19.10; Fri, 16 Mar 2018 10:19:25 -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 S1754391AbeCPPap (ORCPT + 99 others); Fri, 16 Mar 2018 11:30:45 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:36836 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933250AbeCPPam (ORCPT ); Fri, 16 Mar 2018 11:30:42 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 3549A1144; Fri, 16 Mar 2018 15:30:39 +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.9 25/86] IB/mlx5: Fix incorrect size of klms in the memory region Date: Fri, 16 Mar 2018 16:22:48 +0100 Message-Id: <20180316152319.073220372@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180316152317.167709497@linuxfoundation.org> References: <20180316152317.167709497@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.9-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 @@ -1821,7 +1821,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)) @@ -1833,6 +1832,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;