Received: by 10.213.65.68 with SMTP id h4csp2117737imn; Sun, 8 Apr 2018 20:08:50 -0700 (PDT) X-Google-Smtp-Source: AIpwx48H2FLehR1vIafwjaG/z2ph0v/3sCWqPL88T/EdOrFZn+Uu1RpRNvJzegSRQxym1QMwO3lK X-Received: by 2002:a17:902:bf08:: with SMTP id bi8-v6mr3090381plb.392.1523243330418; Sun, 08 Apr 2018 20:08:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523243330; cv=none; d=google.com; s=arc-20160816; b=rD0TF23nEtDLv+V5p3Fva7ex1jvgR0PTLK1fhV/LKs2nEbZPaZRAUNSSXCXy9ZwIN/ KAMwfTyUEuBPPpFvFYDc26vPvXbIK4IZgKX+xnM0D7Ny8IlLs3NrZWO3Nt18BBUBt6/N /x+MHgtZJfE5S5GiYWnDZ7as+QD6VpTCkgf8ZYUuIYYdH4QFhqaqaZSZXLqm0AeKRe2O KiSVvr49mvzJbqDw5JHoXPUDdtFyTLrBBE+hR5iC0uaB+4B+JIsIpZiAHtY5uiwn8xL2 8wYhGQniyFq0nhaiUjWHMp+Ii+6RbyrKaFt/3x42UTeX3I3qz+xLHTGHClN5eRBkRjwG qETw== 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 :arc-authentication-results; bh=eePZViUbVX4/ay6OU1Hq3yx/Yzr6WvJrwZzwkJ2l4ig=; b=qoj1JeuZYhHuUDiUQNwZnrQ8T5oKjEKQfUMXaM25gWDPJSRRoMCV00ufTyqyyYQ89Z fiZmZk5dNlube7AvxOeYU8PLBisWjMWw32DgdMdzW7gKNID/pY2yVY3xIZLmC5yrKcyr eYC/I6OhTzTOgjC4DPusS2Z+OXM/h6JaO35TdOWAtZM7wQE1HYEcEkIwzP9K2wgCyk/Z P65xKvz5fgYvnpUmLslo2bK3gDkkDHW8PPFAP9NTRjRxaLiCwSyJjGBcCQeloRtdXVGR pueQH4Am+/6Hf/HTX+S5wTPJbCFhI1Fw7Z7R21BGVpSIRzFGMp3DrvPOpNa2+5J91yWI D9aw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=V/WUPfzO; 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 12-v6si13749081plb.342.2018.04.08.20.08.13; Sun, 08 Apr 2018 20:08:50 -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=V/WUPfzO; 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 S932180AbeDICOo (ORCPT + 99 others); Sun, 8 Apr 2018 22:14:44 -0400 Received: from mail-dm3nam03on0114.outbound.protection.outlook.com ([104.47.41.114]:52647 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756108AbeDIAag (ORCPT ); Sun, 8 Apr 2018 20:30:36 -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; bh=eePZViUbVX4/ay6OU1Hq3yx/Yzr6WvJrwZzwkJ2l4ig=; b=V/WUPfzOb6PdON1KSk0ejkKYYB/1Y0ct1l5FovHycvxNCW+x0R34+R6b8psLotQnF/wixxmrk9Pxnt0t1yWsrWDlD5jEO07tHvka3lZ3s25XWnKU1e4ponEYO7QPW2HXii2s9w35YeNA3XnWN5Y0ClISv4b6u2uH7dWKaaKDvYY= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB0807.namprd21.prod.outlook.com (10.167.110.154) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.696.3; Mon, 9 Apr 2018 00:30:31 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059%2]) with mapi id 15.20.0696.003; Mon, 9 Apr 2018 00:30:31 +0000 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Nitin Gupta , Julian Calaby , "David S . Miller" , Sasha Levin Subject: [PATCH AUTOSEL for 4.9 145/293] sparc64: Fix gup_huge_pmd Thread-Topic: [PATCH AUTOSEL for 4.9 145/293] sparc64: Fix gup_huge_pmd Thread-Index: AQHTz5kpQ1uW0kxqpkCXtVFxonPwpw== Date: Mon, 9 Apr 2018 00:24:46 +0000 Message-ID: <20180409002239.163177-145-alexander.levin@microsoft.com> References: <20180409002239.163177-1-alexander.levin@microsoft.com> In-Reply-To: <20180409002239.163177-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;DM5PR2101MB0807;7:m5vF7hC7vK5pwG4UjJCd7Dyonqkurf2xk7Co0EfwayRntxW/+WK+z4ezVedflLCNpjf0TLrrQeT+UmIEMOCVKxS8ososLHS2RhzXKIPA8bXR8Azrm5Fm/3/nwKhCYyaWNQY/eRR/CBY0QJOLw0fA+hVNkoqz0j3/wrlZHIVA/yzTD+49mQq15WObrsnGgynj5h7J/I9xyRnAOxwNp8NjHFrEdxwkRIoHbU53r0kjcK042lNj0S/cpvOjm4FEjQEh;20:f80f9ny7FNfcdvH3btFtyPh7lOhrNXqsCodC0BEqyFhyjPAfoTGRVItXWOfwSkDMXXD+S9eTnmJDCcjzHPFKXmD2cBf7RwUBFlpE4HWivBxOHu/rINJ0moQeBEZBoWIRN2Q/elsKkPDEnQU7x5KHOXSZK2yp3by917NEyO0OHFo= x-ms-office365-filtering-ht: Tenant X-MS-Office365-Filtering-Correlation-Id: 082b085e-8d06-4772-4bf7-08d59db11a11 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:DM5PR2101MB0807; x-ms-traffictypediagnostic: DM5PR2101MB0807: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171)(85827821059158)(146099531331640); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(10201501046)(3231221)(944501327)(52105095)(3002001)(6055026)(61426038)(61427038)(6041310)(20161123562045)(20161123558120)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011);SRVR:DM5PR2101MB0807;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB0807; x-forefront-prvs: 0637FCE711 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(39380400002)(39860400002)(396003)(366004)(376002)(346002)(199004)(189003)(14454004)(4326008)(54906003)(25786009)(53936002)(2900100001)(1076002)(3280700002)(6486002)(186003)(2616005)(68736007)(110136005)(11346002)(10090500001)(6116002)(107886003)(3846002)(36756003)(8676002)(72206003)(22452003)(66066001)(26005)(39060400002)(6512007)(478600001)(3660700001)(81156014)(86362001)(81166006)(86612001)(7736002)(305945005)(8936002)(10290500003)(6436002)(105586002)(6666003)(316002)(575784001)(76176011)(5660300001)(476003)(106356001)(2906002)(6506007)(446003)(2501003)(99286004)(5250100002)(486006)(102836004)(97736004)(22906009)(14583001)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB0807;H:DM5PR2101MB1032.namprd21.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: 3Dsx8G/cUECEisyXeKOhuyT0nsQ5FvHQh2EgFdIt6aNFvjjB7FXuO85OQpNX8JR9LfENfyTvhrVdK4TTQ7ri0W9NfQ7Xh9QSmpddxbx/7g5FRMu0MYxc94SwfYWHcxblVT2W74UpGfRndaa41xCoRIrjTAp9JgqDnlI5mUFAagpV/d6wNhPGm+j+Ga+ZWPCMn2y136ico5Fh90sOtfbYvlio414ZIs5pR4idu7ZWOFHE5o5MqDWLVH03zOlNTm8x/JKbb7cLd0e9IRpfS2QkbRUWwV7LPQgJvoyM2FXIOPjSDVSFf25HbgRcWNQ474XK1wzGHvW9xMZvHGaEl9AIucoJEep5E3KzIerzrxMQCEDVAnZstI7IZV7cptarU5xIBPqeVD7UQT065fMns2obSVd8t4Ysmt+d53DWT2zdlBM= 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: 082b085e-8d06-4772-4bf7-08d59db11a11 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2018 00:24:46.6594 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB0807 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Nitin Gupta [ Upstream commit dbd2667a4fb9ce4f547982b07cd69dda127c47ea ] The function assumes that each PMD points to head of a huge page. This is not correct as a PMD can point to start of any 8M region with a, say 256M, hugepage. The fix ensures that it points to the correct head of any PMD huge page. Cc: Julian Calaby Signed-off-by: Nitin Gupta Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- arch/sparc/mm/gup.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/sparc/mm/gup.c b/arch/sparc/mm/gup.c index cd0e32bbcb1d..f80cfc64c55b 100644 --- a/arch/sparc/mm/gup.c +++ b/arch/sparc/mm/gup.c @@ -78,8 +78,8 @@ static int gup_huge_pmd(pmd_t *pmdp, pmd_t pmd, unsigned = long addr, return 0; =20 refs =3D 0; - head =3D pmd_page(pmd); - page =3D head + ((addr & ~PMD_MASK) >> PAGE_SHIFT); + page =3D pmd_page(pmd) + ((addr & ~PMD_MASK) >> PAGE_SHIFT); + head =3D compound_head(page); do { VM_BUG_ON(compound_head(page) !=3D head); pages[*nr] =3D page; --=20 2.15.1