Received: by 10.223.176.5 with SMTP id f5csp804484wra; Sat, 3 Feb 2018 10:40:11 -0800 (PST) X-Google-Smtp-Source: AH8x224JKnQCpadq5OiDeJcmFBHC32w/DZnWnE20Z+ANAbFwpt/1ghyUP7aL9e11htWOQoz9Stxq X-Received: by 2002:a17:902:5914:: with SMTP id o20-v6mr30610305pli.196.1517683210917; Sat, 03 Feb 2018 10:40:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517683210; cv=none; d=google.com; s=arc-20160816; b=OIi31+4xs1va6FtK6YG8keB5Wkb+kS9ScAyMv+CDQ69hUSEKU1sjd/FWH3i2PF6c5p F2WAEyKVu5fzS/YMIiHDD2aREQe0Zl2TV5YFtki/CJROEGSYdGj0qt4d5QSV2xuMslwT EpQHiSWnUFmIaaxnIPe2h6pTUHhM1l6AwUBAwLnq6cfxnyd34aKMXgeQOfYinhJfSxEW WgLmtEFt5rO3QPiv0tw1EP1xgVHaodaDDfzSPIPwNYXcaGuiQZ39NdBPIQVbpwEqRRRY VZ29RiIDCrdvBLVxKQHPHSDjNqOQ7yCFx2VPUofrN1lbXJYcwY+U3RS7Xdmwbh/V7nzX lQdA== 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=gdfMOP3iX8qN6ZPLw4/H4+OP4iorcQZrARUpUl1NI70=; b=Txz/VCKAAQgq8oc31iPfltaIYNb3CxKPG4lPSq4bp2XXN604Rddv3Yr+RdRzXqaag2 pJO3X83q9jAXzzBXQoXCUrj8EsgzocTGU7UTZSiMObz8ffW49gRV9qqJlbfLMF+gFpzf /tgFlBgSLTYC6eLSim9JcOuA0XUpin9Y8CErCel8iUZvOFXrcxz4C9ambiltH7Y912bN hxh2jKYfOqUjuWKSTtI7XqXqKgi1m01nHkVjxZrM4+Gjnp4XYFRurfhhGsgFEoX2YFAb cKrM726RyJVE1fJlF6wOnLmfgdd/gKc6r2EHkJwrRos1xi9gXbcqdYDwxCWU6gPmUm4v hOxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=ER9u6+le; 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 z1-v6si2039745pln.408.2018.02.03.10.39.56; Sat, 03 Feb 2018 10:40:10 -0800 (PST) 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=ER9u6+le; 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 S1754427AbeBCSib (ORCPT + 99 others); Sat, 3 Feb 2018 13:38:31 -0500 Received: from mail-bl2nam02on0113.outbound.protection.outlook.com ([104.47.38.113]:13185 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752966AbeBCSDo (ORCPT ); Sat, 3 Feb 2018 13:03:44 -0500 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=gdfMOP3iX8qN6ZPLw4/H4+OP4iorcQZrARUpUl1NI70=; b=ER9u6+leXu5Z3Pmjpi4fcECVXIipkkwfMFWBYrtViPCGBsynlzNa6Zjz5ABr1oMvjcB+AYc6TsiRf4yWzfrdEaqUrilp4ZAxgigCWzRuxfqU1DVqYYIyeUEs+nEdDtDpJavYC2U9Eantk7LQ2BgDPVhhBJPVgLQEr9iuPDbi4i0= Received: from BL0PR2101MB1027.namprd21.prod.outlook.com (52.132.20.161) by BL0PR2101MB0993.namprd21.prod.outlook.com (52.132.23.155) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.485.5; Sat, 3 Feb 2018 18:02:52 +0000 Received: from BL0PR2101MB1027.namprd21.prod.outlook.com ([fe80::a8da:b5d9:d710:9bf9]) by BL0PR2101MB1027.namprd21.prod.outlook.com ([fe80::a8da:b5d9:d710:9bf9%3]) with mapi id 15.20.0485.006; Sat, 3 Feb 2018 18:02:52 +0000 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: Ross Lagerwall , Boris Ostrovsky , Sasha Levin Subject: [PATCH AUTOSEL for 4.14 103/110] xen/gntdev: Fix off-by-one error when unmapping with holes Thread-Topic: [PATCH AUTOSEL for 4.14 103/110] xen/gntdev: Fix off-by-one error when unmapping with holes Thread-Index: AQHTnRkGX4BksdyDh0SfOWoTE6AIyw== Date: Sat, 3 Feb 2018 18:01:32 +0000 Message-ID: <20180203180015.29073-103-alexander.levin@microsoft.com> References: <20180203180015.29073-1-alexander.levin@microsoft.com> In-Reply-To: <20180203180015.29073-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;BL0PR2101MB0993;7:sSc5ispOjJnadNV2JnDpNdqrExqmehmK2Al+1c5yNEWJKWdtmR9cb9OW/xI0gS/FzG4ZzvOhQQm/MQ9AyxU96Xrp2+TJ2cIPZnu+1OrTe3Hhjxk9f8k8tQo4sGT7bnZ+o6LBT3m8thbrheDGsnyuS84Ugogp5tUX3oMQFBwTijTjCYOtNeGNx9rvYFt1Zfndde8dsQmcTm7tVaTxf4mKokHgWfdB48syhj0E+kg9NnJ16k9HhQOiZfyb6AVLDoAe x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: d07cc952-c0e8-4dc8-308a-08d56b305836 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(3008032)(2017052603307)(7193020);SRVR:BL0PR2101MB0993; x-ms-traffictypediagnostic: BL0PR2101MB0993: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171)(70601490899591)(146099531331640); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(61425038)(6040501)(2401047)(5005006)(8121501046)(3002001)(10201501046)(3231101)(2400082)(944501161)(93006095)(93001095)(6055026)(61426038)(61427038)(6041288)(20161123558120)(20161123560045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(6072148)(201708071742011);SRVR:BL0PR2101MB0993;BCL:0;PCL:0;RULEID:;SRVR:BL0PR2101MB0993; x-forefront-prvs: 05724A8921 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(346002)(39380400002)(39860400002)(376002)(366004)(396003)(189003)(199004)(6436002)(186003)(3660700001)(8936002)(105586002)(2906002)(6346003)(6116002)(3280700002)(3846002)(97736004)(6486002)(1076002)(8666007)(2950100002)(6666003)(81156014)(86362001)(76176011)(102836004)(2501003)(5250100002)(26005)(68736007)(10090500001)(81166006)(8676002)(53936002)(5660300001)(22452003)(305945005)(107886003)(7736002)(4326008)(86612001)(36756003)(99286004)(316002)(6512007)(10290500003)(72206003)(6506007)(14454004)(478600001)(25786009)(106356001)(2900100001)(54906003)(110136005)(66066001)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:BL0PR2101MB0993;H:BL0PR2101MB1027.namprd21.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; 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: eF1TGjCEytPrIjWVt2kpne1+PneLnnwTeNY6fPGNpcWHoWPayYCj7yu33jCcdw2ujNXBbSvxxrM3/xUBvK3pwQ== 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: d07cc952-c0e8-4dc8-308a-08d56b305836 X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Feb 2018 18:01:32.8315 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR2101MB0993 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ross Lagerwall [ Upstream commit 951a010233625b77cde3430b4b8785a9a22968d1 ] If the requested range has a hole, the calculation of the number of pages to unmap is off by one. Fix it. Signed-off-by: Ross Lagerwall Reviewed-by: Boris Ostrovsky Signed-off-by: Boris Ostrovsky Signed-off-by: Sasha Levin --- drivers/xen/gntdev.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/xen/gntdev.c b/drivers/xen/gntdev.c index 57efbd3b053b..d3391a1e3796 100644 --- a/drivers/xen/gntdev.c +++ b/drivers/xen/gntdev.c @@ -380,10 +380,8 @@ static int unmap_grant_pages(struct grant_map *map, in= t offset, int pages) } range =3D 0; while (range < pages) { - if (map->unmap_ops[offset+range].handle =3D=3D -1) { - range--; + if (map->unmap_ops[offset+range].handle =3D=3D -1) break; - } range++; } err =3D __unmap_grant_pages(map, offset, range); --=20 2.11.0