From patchwork Wed Apr 26 08:31:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Gurtovoy X-Patchwork-Id: 9700637 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A780D60245 for ; Wed, 26 Apr 2017 08:32:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9274727F95 for ; Wed, 26 Apr 2017 08:32:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 86D35280CF; Wed, 26 Apr 2017 08:32:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 970F527F95 for ; Wed, 26 Apr 2017 08:32:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1955520AbdDZIcR (ORCPT ); Wed, 26 Apr 2017 04:32:17 -0400 Received: from mail-he1eur01on0050.outbound.protection.outlook.com ([104.47.0.50]:37173 "EHLO EUR01-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1954347AbdDZIcD (ORCPT ); Wed, 26 Apr 2017 04:32:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=ZNut968q8/Uks/149Y0244/+lEymAyz2ILX92tMyiRE=; b=dQXLluVbfWG7vIv7YGT35RqTcReDznsSDyVakx34II9TZQO0f0Fc1020YCO9o+5ej0MrepcQYTq5dKi90/WyaGhWQP9f7VS5tCX3QtjtPl7/AjA5hFa4TnosJXokemb7TSfWdSzbhHciWJqufLHKOMdr7SuWKsz6hpnDGAokv9w= Received: from VI1PR0501CA0011.eurprd05.prod.outlook.com (10.172.9.149) by VI1PR0502MB2942.eurprd05.prod.outlook.com (10.175.25.136) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1047.13; Wed, 26 Apr 2017 08:32:00 +0000 Received: from AM1FFO11FD014.protection.gbl (2a01:111:f400:7e00::117) by VI1PR0501CA0011.outlook.office365.com (2603:10a6:800:92::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1061.12 via Frontend Transport; Wed, 26 Apr 2017 08:32:00 +0000 Authentication-Results: spf=pass (sender IP is 193.47.165.134) smtp.mailfrom=mellanox.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=pass action=none header.from=mellanox.com; Received-SPF: Pass (protection.outlook.com: domain of mellanox.com designates 193.47.165.134 as permitted sender) receiver=protection.outlook.com; client-ip=193.47.165.134; helo=mtlcas13.mtl.com; Received: from mtlcas13.mtl.com (193.47.165.134) by AM1FFO11FD014.mail.protection.outlook.com (10.174.64.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.1047.9 via Frontend Transport; Wed, 26 Apr 2017 08:32:00 +0000 Received: from MTLCAS13.mtl.com (10.0.8.78) by mtlcas13.mtl.com (10.0.8.78) with Microsoft SMTP Server (TLS) id 15.0.1178.4; Wed, 26 Apr 2017 11:31:59 +0300 Received: from MTLCAS01.mtl.com (10.0.8.71) by MTLCAS13.mtl.com (10.0.8.78) with Microsoft SMTP Server (TLS) id 15.0.1178.4 via Frontend Transport; Wed, 26 Apr 2017 11:31:59 +0300 Received: from [10.223.3.143] (10.223.3.143) by MTLCAS01.mtl.com (10.0.8.71) with Microsoft SMTP Server (TLS) id 14.3.301.0; Wed, 26 Apr 2017 11:31:57 +0300 Subject: Re: [PATCH, untested] mlx5: Avoid that mlx5_ib_sg_to_klms() overflows the klms[] array To: Laurence Oberman , Leon Romanovsky References: <8992bd28-667f-94b1-e582-106e6b41aa4b@sandisk.com> <20170425175849.GS14088@mtr-leonro.local> <438230391.2090966.1493152655709.JavaMail.zimbra@redhat.com> CC: Bart Van Assche , Doug Ledford , Sagi Grimberg , Israel Rukshin , From: Max Gurtovoy Message-ID: <896e9a9e-43b6-7a21-e41b-861e4f795436@mellanox.com> Date: Wed, 26 Apr 2017 11:31:57 +0300 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <438230391.2090966.1493152655709.JavaMail.zimbra@redhat.com> X-Originating-IP: [10.223.3.143] X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:193.47.165.134; IPV:NLI; CTRY:IL; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(39850400002)(39410400002)(39860400002)(39400400002)(39840400002)(39450400003)(2980300002)(438002)(189002)(377454003)(24454002)(199003)(13464003)(9170700003)(229853002)(6116002)(65806001)(23676002)(81166006)(8936002)(3846002)(6246003)(230700001)(6636002)(83506001)(65956001)(47776003)(64126003)(65826007)(77096006)(53546009)(5660300001)(356003)(4326008)(2950100002)(305945005)(31686004)(7736002)(189998001)(38730400002)(31696002)(50466002)(50986999)(575784001)(76176999)(8676002)(4001350100001)(8656002)(33646002)(54356999)(6306002)(54906002)(86362001)(36756003)(2906002)(106466001)(15760500002)(3940600001); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR0502MB2942; H:mtlcas13.mtl.com; FPR:; SPF:Pass; MLV:sfv; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; AM1FFO11FD014; 1:GAoDt1sH2sB8ZJ/0SwLJPDN94AppO+/no8ysGJxoDdXXPiXxio4N2NVZvbfyXSRHXP+VMLpWkyBO2DcPIm6RaMipaCw9j2pMvvY9fg+kKCPUtT3e0JgAwD2vxNOa9FHxRCEzR0hzVfIEzcNRUIYRSrgKeSKBhXQjWXmvOEVRVUTX5PT9JgDZuopi5lo2GpJmT0NKCyJbkLQlO3HfC+0iQvTjLw6qsKkcgO3h5pPJMS2BMNv4cmgm9v4vUGGEck3RJfu24V5Sg/TWdcZgFXyb9eTO6E7drCJK1swqyPRs1TEuNahJUhJdSu8CpX/yz0i1C/BRNnkuRl5LCCWV1trDv4vErr4n3izKpiqP7AdPg2oPaa6Vm9GchQW4xketWDq6XMTGo0FEcGIbWxxhKK95fcssdG1nZu7Qfrhhf+Pn9v7WSVy7jY13bAVktm9ByVE5LCkg+WozIrGijbpYflr3g6m0oJ1ovBO+JLuzp7bd9ItSVXLQrptG3v3IXb8Yjo4t6Mn8p597JUawypQzUZe62o5MlW0mE0tFHQohKr72T0233N5/hpeLIV2cnP6XTIaqgP23Vdiq8yPHxysbq6+nfw== X-MS-Office365-Filtering-Correlation-Id: 70340300-5aa7-4fd1-f383-08d48c7eb57c X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(8251501002)(2017030254075)(201703131423075)(201703031133081); SRVR:VI1PR0502MB2942; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0502MB2942; 3:AFqpZQ35oyb0cxiBtih7kTqplcGU0b6zcv+yBMN9sMnOkrU768d+8yNPEt/Ugz6xEDho3UvmO9SlzB+w+lzVlZnXAEk1i0O0GUzPTSCgeJcnabm+BRASlj+D1Dd5ROQmmSW0lIaHcroYpywX1dwoRCJDC6KKYYMv9EH/WuH1SX6pbIn6/iIFAZ7ZYfMdunVjIiDvperKBIuaZ+BzKxITyqRtxZlWe+b0n+AnT+jpvg5HWYEN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yXl6+Qi4= X-Microsoft-Exchange-Diagnostics: 1; VI1PR0502MB2942; 20:uxVf6LntyhexYsAJ2B00z6LVf5f6ZmzHAPrLGngDMevsQKOWrM4WNz6LL3+7NgaV+R3fcU+Zz2XzqOWhb5SGHZ+e4zBIo78ACCg4XtBELqhgqh8F+SMIskpiY51ovyNsluOb0iQcLW2NRjYeHPmazHDt4RW6o1K0dNGWEa8GKrKfm+rgopHX6KSQJsv+9aHioApsrX5MddQ/VFsGmUnmRdyogFRuwNV6JQspoatEgnIXfn0qjphpZYN0K0TqgXul9JaEJbWSDQBgtgbqEpNdWUe4xEf0J2QIdonIW1CN46RduDAw2LGmQ2rZJumiKHA3wQZmTCGVRGlBsT6EUIMfYpP8EITGMhgwuxIxRls8gtoqqhcp5U8Kx6mEZOHTFtMF4c1YTs6O/53x61tw3vljni7F3wCUxhp1ou/+jbPjhAAxDszfvjJWo1T3VWm1kM04k8vrvostyfct35mQN5QGE2nOJEf/4PGBKvo5RawA56wBE+f3o2i/UXKunMAZN4Jq X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(166708455590820)(9452136761055)(131327999870524)(265634631926514)(42932892334569); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(601004)(2401047)(13018025)(8121501046)(5005006)(13016025)(10201501046)(93006095)(93004095)(3002001)(6055026)(6041248)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(20161123562025)(20161123560025)(20161123555025)(6072148); SRVR:VI1PR0502MB2942; BCL:0; PCL:0; RULEID:; SRVR:VI1PR0502MB2942; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtWSTFQUjA1MDJNQjI5NDI7NDpaN2o0OVd3cFU1dzVaZnJrQkpYNGUzdTJm?= =?utf-8?B?bGRFTllUa0tRMVhCcFZrV0dzTFc3dDBsc0ttdnVtOUNLeUl5VTR1aFpjY1hO?= =?utf-8?B?bFcyNUljTnY0WXh0U0drMDlMZEZnWm1kS0c4QUJQ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IMxrICAGgIyFcMWxEE05g4EqVTjTPDcg8AA+Ipf4h4dbNjiysqGk1gVYhkZBI4bwxPNJgiKMzZchjkTZFmKF/VBfsv6sHkyTwZo0bc5VCaEaFNKgxurwI6PlDuk1u6aU/XL5x9bi9PoQFk=; 5:NHJ6oeoY7D/ilN9YkSGQ/6lWZFDmdGhPiLPHcSg8ceAdDuS6+yU7Ux0DoIH0mlgCwL+B8MwvKW0ppxHNcGA12QlpraIPSrcASHkEVMv+vwRpsuQJw+4X0mj1q3FnRevrIk83V2QGsidF4IKo1Mbuzw==; 24:XZnKzCQ8iKnaqKTQho0p6sTgUXyg9+1OLNAtM8uU9ZRuxt5RvlpYRrz8lJwV6ttqYvuZv+abs2ZXE8cG1vHpV3atZ1PPGh1zli5QXAXPWAc= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; VI1PR0502MB2942; 7:/XLOE0LaaqY4Apx4/xJXB5yE2Ze4UWK8OnAfriUq447YUlRcELoVRypAgIp0i7zVFHH2yWZ4nDHtJ0kdhhxGqD/oB0aChsPiGp28hJXfXqEkZruT6Kyt8HIThHdK3GIvdJGL7mzl8PldImtY+daFGYXFEnWVzwTd5GXY0MrjlgwesMM70p0R2onEvBhLoiQkwTVwYqVPfkcS/IkGFKV9RSRc4AHwUk51LJN42uSClFnvgwRosVlSIsqCSLhPDDGs05h4HVXCSaVG2+PgkzhQesVvTn63IEkykkF7dn2PARjtUftkvg2ADLl2/hIYYeO1HVxjEx+BfkFn3FyoO4GjDQ== X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Apr 2017 08:32:00.1595 (UTC) X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=a652971c-7d2e-4d9b-a6a4-d149256f461b; Ip=[193.47.165.134]; Helo=[mtlcas13.mtl.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0502MB2942 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On 4/25/2017 11:37 PM, Laurence Oberman wrote: > > > ----- Original Message ----- >> From: "Leon Romanovsky" >> To: "Bart Van Assche" >> Cc: "Doug Ledford" , "Max Gurtovoy" , "Sagi Grimberg" , >> "Israel Rukshin" , "Laurence Oberman" , linux-rdma@vger.kernel.org >> Sent: Tuesday, April 25, 2017 1:58:49 PM >> Subject: Re: [PATCH, untested] mlx5: Avoid that mlx5_ib_sg_to_klms() overflows the klms[] array >> >> On Mon, Apr 24, 2017 at 03:15:28PM -0700, Bart Van Assche wrote: >>> ib_map_mr_sg() can pass an SG-list to .map_mr_sg() that is larger >>> than what fits into a single MR. .map_mr_sg() must not attempt to >>> map more SG-list elements than what fits into a single MR. >>> Hence make sure that mlx5_ib_sg_to_klms() does not write outside >>> the MR klms[] array. >>> >>> Fixes: b005d3164713 ("mlx5: Add arbitrary sg list support") >>> Signed-off-by: Bart Van Assche >>> Reviewed-by: Max Gurtovoy >>> Cc: Sagi Grimberg >>> Cc: Leon Romanovsky >>> Cc: Israel Rukshin >>> Cc: >>> --- >>> drivers/infiniband/hw/mlx5/mr.c | 2 +- >>> 1 file changed, 1 insertion(+), 1 deletion(-) >>> >> >> Bart, >> >> Thanks a lot, it indeed looks right. >> Acked-by: Leon Romanovsky >> >> Thanks >> > > > Hello Bart, Leon, Max and Israel. > > I cloned off Barts tree. > > git clone https://github.com/bvanassche/linux > cd linux > git checkout block-scsi-for-next > > I checked all patches were in for this test. > > a83e404 IB/srp: Reenable IB_MR_TYPE_SG_GAPS > dfa5a2b mlx5: Avoid that mlx5_ib_sg_to_klms() overflows the klms[] array > f759c80 mlx5: Fix mlx5_ib_map_mr_sg mr lengt Hi, copying Sagi's request from different thread: " Can you please enable srp_add_one debug: echo "func srp_add_one +p" > /sys/kernel/debug/dynamic_debug/control In addition apply the following: diff --git a/drivers/infiniband/hw/mlx5/mr.c b/drivers/infiniband/hw/mlx5/mr.c index d9c6c0ea750b..040fbc387e4f 100644 --- a/drivers/infiniband/hw/mlx5/mr.c +++ b/drivers/infiniband/hw/mlx5/mr.c @@ -1403,6 +1403,8 @@ mlx5_alloc_priv_descs(struct ib_device *device, int add_size; int ret; + WARN_ON_ONCE(ndescs > device->attr.max_fast_reg_page_list_len); + add_size = max_t(int, MLX5_UMR_ALIGN - ARCH_KMALLOC_MINALIGN, 0); mr->descs_alloc = kzalloc(size + add_size, GFP_KERNEL);