Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp3496674imm; Sun, 16 Sep 2018 20:25:12 -0700 (PDT) X-Google-Smtp-Source: ANB0VdboOM05sOio9kGXVduu5D1t57Qn7xHd41OC5SrlTSsTIjVOX4FqMztHSq8uqgjC/VOa9gOH X-Received: by 2002:a63:1d47:: with SMTP id d7-v6mr21574036pgm.180.1537154712287; Sun, 16 Sep 2018 20:25:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537154712; cv=none; d=google.com; s=arc-20160816; b=bDfLjsf0L3Cw1hMia57Fi6NMUXISitu5exMjiyfBDntjUWlD4u6ViZgx51jua4fM3u omacT5IEkZeCo5DfZ2TWPZwMImKnK5tkaRcNIHdBEPT013gXpRHYtn7agWFQ5p0hlKC/ 2zUVyzkCCxbeWXQTb+6sUanwkdHKn6VEXSNh8zUFHN96ysoThCzTYyL5jMSnVHgdrSAc AIjP8MtynEIhv399V6ZC3jfSLickvhKgKJiJjfDK8MCPRGXW4quFiFShPmDO6QXMpPZc pH5n9mMqoGWIkSTJSHujAXQ7IyZH2ugBn9OWszrtdyQIfMlS6QePJWdZxSKu6JronX6F grPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature; bh=HlSx/xIZIXt2oyb+V8xqZ2cgHkgVdyIGE4Y9wbrjXtY=; b=jzF2O6ZcSITReX7xczoM7SpNkzFiJr+Xn++uIUk75wjkY1NovTI1kcU+sJXhSE4YBG nxx+82y55rxGl5C/AAUoskfe57LAY9hYCbFk/w4hJ5zEzYsdOLSW/IDmbun73uQOStzV 3HJuF5CxmKHR+EbZFBO7aX9+e3y7Th2lhxF1LTm/DehheWn9YoTZ+Pl5jECIlj478YWr o+LafVBDcMKJH6EVIpV/7HNXSD9fifCLMpQwI3Uk/78zTOJ+2Q/nC29JxomR1jwGOQbe Q3tya+VgI1Woriha+9lzyGCRawejmSGAUvw46E11jvIx9/eCsRSf5mwSyps/XVWA2Gx9 m6+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=Rfp7dGq9; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x22-v6si13940074pfh.84.2018.09.16.20.24.57; Sun, 16 Sep 2018 20:25:12 -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; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=Rfp7dGq9; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730025AbeIQI3C (ORCPT + 99 others); Mon, 17 Sep 2018 04:29:02 -0400 Received: from mail-eopbgr680131.outbound.protection.outlook.com ([40.107.68.131]:11025 "EHLO NAM04-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729938AbeIQI27 (ORCPT ); Mon, 17 Sep 2018 04:28:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=HlSx/xIZIXt2oyb+V8xqZ2cgHkgVdyIGE4Y9wbrjXtY=; b=Rfp7dGq98Ibwmq48MXtv3CMVnVU4N155Nzu6gH6qu4cOOSr/Kr7yZpw8MuTHnGgvytmzHONic01IzJJ+2FXli9bMBRwlKhhOCUbqY2TiY1srweBDqn7O3CFGWmhh0QYviZq9ptsU8+6XWEL+ElCNkSdx4Oto6P9wsBkElHlCpHY= Received: from CY4PR21MB0776.namprd21.prod.outlook.com (10.173.192.22) by CY4PR21MB0470.namprd21.prod.outlook.com (10.172.121.148) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1164.12; Mon, 17 Sep 2018 03:03:37 +0000 Received: from CY4PR21MB0776.namprd21.prod.outlook.com ([fe80::54e2:88e0:b622:b36]) by CY4PR21MB0776.namprd21.prod.outlook.com ([fe80::54e2:88e0:b622:b36%5]) with mapi id 15.20.1185.003; Mon, 17 Sep 2018 03:03:37 +0000 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Leon Romanovsky , Jason Gunthorpe , Sasha Levin Subject: [PATCH AUTOSEL 4.14 21/87] RDMA/i40w: Hold read semaphore while looking after VMA Thread-Topic: [PATCH AUTOSEL 4.14 21/87] RDMA/i40w: Hold read semaphore while looking after VMA Thread-Index: AQHUTjLjqjMD1llMRU2dvEcuIhO75A== Date: Mon, 17 Sep 2018 03:02:37 +0000 Message-ID: <20180917030220.245686-21-alexander.levin@microsoft.com> References: <20180917030220.245686-1-alexander.levin@microsoft.com> In-Reply-To: <20180917030220.245686-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;CY4PR21MB0470;6:hB+N8m24wK0z7Oyo3PGZJWrgiDrYOX0F+EUeskOzArca5aPZabNz84YToxLAANwD5D8VEGtXR0kQWRAnaeTswiKqsqkfcjgr2/pwXARrqGDVNAS7m6SAsXQTWHTRNaxGcOjp+RWMKs11ZSOsFNIrq5etMXhyNub0V4QtCDeae2SfemmY2Kg3AhT5Eix1ztpQB+fQjj8uFJEkb9EdSZRTTCMJqRifF2ahXGvjvuTKHGf5Xbv68sD0DEXSn8jvdabhxNsfS7r3iDI7xj38cUMQtXi3kiWRSCxwwNJM5/vCdniIGKX82dwafhuRCb2HFAWHKRs4NTM+8Y+QtPAvXtKl4ZOv+WydVNCTu/E240N6uYdQBQtJqOMxRCdHrTEStvXPuWc1rao43G+SrtMzvbdNAQJWJsgrpVY72ZCF1Gg+7OtdqJpJnxZQnEZpR5cGlupMHhMtBSt6easklCfsMOCDbA==;5:3qtaLxexIGUB22KYbIA00hezv0bzJrAjx77XK/EwGzLe79Z7s6YZoc/BFIya7rpEpAV5mZSFTHOgWTkgDJ4A47HPRomMKhXB+wVBqAujtCcnC1+1WzR47qK/aKoTUJj/aUIaoeQA+q9PiuE/5JnqftQdUMssV3RXrVDHpnhz82A=;7:gWL7/qygS64ylYwwKm74hDmLTottnViGuhPaQsMNjhxL4otXHR8D1+EOnFYZzq7mG1yTbkysF6lSN6AjoeIPVTFoVHVJwDhOPhlBTDtY/LVmzFsw0+jWe5T+QVdl2yPw3t5DKSDFaT+9f2Qe7HeRq7neBVs21MZ6ZydSJ1P0CF9n8Y5b0g+GTnPZiUPbgl9qUhZjkYpDIRrv4X0C02MFb+NKzj21oBIzOQBREai9fTM9iXGSHhdYJTsMtmMKi3sY x-ms-office365-filtering-correlation-id: b144d5fd-4b40-40d7-8f8d-08d61c4a29c1 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989137)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(4618075)(2017052603328)(7193020);SRVR:CY4PR21MB0470; x-ms-traffictypediagnostic: CY4PR21MB0470: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(10201501046)(3002001)(93006095)(93001095)(3231355)(944501410)(52105095)(2018427008)(6055026)(149027)(150027)(6041310)(20161123562045)(20161123564045)(20161123560045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699050)(76991041);SRVR:CY4PR21MB0470;BCL:0;PCL:0;RULEID:;SRVR:CY4PR21MB0470; x-forefront-prvs: 0798146F16 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(396003)(376002)(346002)(39860400002)(366004)(136003)(189003)(199004)(1076002)(25786009)(4326008)(107886003)(5660300001)(3846002)(6116002)(54906003)(110136005)(22452003)(316002)(86612001)(76176011)(53936002)(6512007)(68736007)(7736002)(305945005)(86362001)(575784001)(2900100001)(256004)(66066001)(8936002)(11346002)(446003)(10290500003)(6486002)(14454004)(81156014)(486006)(6506007)(2501003)(99286004)(26005)(2906002)(10090500001)(478600001)(72206003)(105586002)(6436002)(102836004)(186003)(8676002)(2616005)(476003)(5250100002)(36756003)(81166006)(106356001)(6346003)(97736004)(217873002);DIR:OUT;SFP:1102;SCL:1;SRVR:CY4PR21MB0470;H:CY4PR21MB0776.namprd21.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-message-info: 6feAIxQRZHMZHBIGpqj/2iZxhhgC1oeX+cml+OPlt4tDOAUwIPRenYsWPZZP9JbsDKEOoAzRRO8SuNy/nPIfGhDD6D0fsC34131y+SIMmxiAKE9kLU+svc6/d0rWp0W+OIAWK9dlgZPpj+dKHQc/+ZJv/OsUbaKlk8ekcu3xTgh+RBUQCSLVxrdSJLMrHu5k7hL/PcpC4MQakFxiWV1+r8cIFMMBIP38bqHqLaO6jk2jD/+xBImhHIOhJNdSuhr+eWcgZvdrdLp/sKXUWcNo7bbylC5AJhsaJj8aUnKHHUu7ULAqBym+znOlldbxMqPHavpGLMR37uLxVCAPKPsUBDxuEzW7AzM5B/rrj8tB/rk= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: b144d5fd-4b40-40d7-8f8d-08d61c4a29c1 X-MS-Exchange-CrossTenant-originalarrivaltime: 17 Sep 2018 03:02:37.2750 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR21MB0470 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Leon Romanovsky [ Upstream commit 5d9a2b0e28759e319a623da33940dbb3ce952b7d ] VMA lookup is supposed to be performed while mmap_sem is held. Fixes: f26c7c83395b ("i40iw: Add 2MB page support") Signed-off-by: Leon Romanovsky Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin --- drivers/infiniband/hw/i40iw/i40iw_verbs.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/infiniband/hw/i40iw/i40iw_verbs.c b/drivers/infiniband= /hw/i40iw/i40iw_verbs.c index b7961f21b555..39398dd074d6 100644 --- a/drivers/infiniband/hw/i40iw/i40iw_verbs.c +++ b/drivers/infiniband/hw/i40iw/i40iw_verbs.c @@ -1408,6 +1408,7 @@ static void i40iw_set_hugetlb_values(u64 addr, struct= i40iw_mr *iwmr) struct vm_area_struct *vma; struct hstate *h; =20 + down_read(¤t->mm->mmap_sem); vma =3D find_vma(current->mm, addr); if (vma && is_vm_hugetlb_page(vma)) { h =3D hstate_vma(vma); @@ -1416,6 +1417,7 @@ static void i40iw_set_hugetlb_values(u64 addr, struct= i40iw_mr *iwmr) iwmr->page_msk =3D huge_page_mask(h); } } + up_read(¤t->mm->mmap_sem); } =20 /** --=20 2.17.1