Received: by 10.223.176.5 with SMTP id f5csp803102wra; Sat, 3 Feb 2018 10:38:09 -0800 (PST) X-Google-Smtp-Source: AH8x2260lmNUHL9mN3SKIvEtsYK0n7fnFSZY2kzPcTJ2v5n/aUHh1pW6yObabmyLBzvLFfArFory X-Received: by 2002:a17:902:bd84:: with SMTP id q4-v6mr29521346pls.247.1517683089355; Sat, 03 Feb 2018 10:38:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517683089; cv=none; d=google.com; s=arc-20160816; b=lupK08pNpZDf8e5lxRrP39QoosHukuwHFqLYkS+Bcs/p/bytNwQOjSsZQjrKSwhJoX OD6wGn/HK2b46BpZOzdXlhuNhRGswLhRSrxX0QX48Z/VQ6rM6Clm6f1Jl2heTywbubpD ct5OFqmlI9UxL+ffhEb98l/QGUEbdYzaynyZMGun9CBDSwHNiDdBHFbI4Hj+uMUxfo0m Sd95FL3qGyWjBjcPNUSoBOtHOGSgnU5HbdTdnHI1AhyUwLurogDUz1hfr7kyaXgsW/ZE R+Lgtud41OWJ0togbg7T1f5W/t9A4+57yt/MIYcWWBuAAjvm3s4nxeX8u0LAgMGdszoP VVaQ== 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=7b6NXuEr92jeEyv965PAyrnel5VBD6qQgvgDuVskg7Q=; b=cQS3rEhfQM/5kDm1VRGrYczxCtsueOhHMZh8x1DxXJvGyrilG9NJepswtHC7hQMEuj XSEhfd1XYPQ1F52HXYluw2gGPjMXofqZGkx93L6LqzAsSMRYECVnCTwzGrMgY/ssqBNw uZnpYpe7Q0MqB17eoQ6gEIidUCU8QvESbivNNi9IkcxutBul9X/fifdaoTshhn7uZ4kR RkkuJGq2UOhxMTvBHQWcqCXwjYP/b0pxGfKREApRAaLKDZ7RG4e8sYPtI454YxH4QJCK rQ+GRcp9lyMJgKzRCJGNgPJhvAej/jgYkZA68rTIgxpgeNvMaAmA8WBN40KHPBTaJbPS geUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=LQSy3sM/; 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 n71si4027356pfk.103.2018.02.03.10.37.55; Sat, 03 Feb 2018 10:38:09 -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=LQSy3sM/; 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 S1754795AbeBCSfx (ORCPT + 99 others); Sat, 3 Feb 2018 13:35:53 -0500 Received: from mail-bl2nam02on0091.outbound.protection.outlook.com ([104.47.38.91]:45338 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753293AbeBCSEE (ORCPT ); Sat, 3 Feb 2018 13:04:04 -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=7b6NXuEr92jeEyv965PAyrnel5VBD6qQgvgDuVskg7Q=; b=LQSy3sM/+4h1w7BYc8h/cZg9tHiLQRHH+4N67JtnfMoMh4j4wfw4mpvd0EEBm71Jwhk6LAYCId5w1TS8OXHaI0BCOkIm21lRdZ31qVW8keWYNuSn4teuQ4MV9BQgeWFL5dasOUPF8n2aUfyQRBF+D5WRKuApVwlhW88GPRoAGrQ= 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:53 +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 104/110] xen/gntdev: Fix partial gntdev_mmap() cleanup Thread-Topic: [PATCH AUTOSEL for 4.14 104/110] xen/gntdev: Fix partial gntdev_mmap() cleanup Thread-Index: AQHTnRkGboIa0o9odU6MhvxINVTtbQ== Date: Sat, 3 Feb 2018 18:01:33 +0000 Message-ID: <20180203180015.29073-104-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:72O0gVr5VJWG1CfRQZ9eK2x52xARYqJLCPO5I7hjM7TzsgqpxTJ/wKm/8ZSvTsG3aZIPFLUG/QnejduGp2ygZ7494j19fTOw+4qdemyVd2GldAouVeXKnWQ0A2jcPhfodtfYJq8NJkIq6TemiJPPVsXLIktdjY2HqFklJZ88NVqfNiRcpZoT51czfsKDp2cCiFhuOvhv83fT5R71o8VvRv+I8hUJVRNyRF9ElvBcKbCliL04nLp27cHcM2U6hhRT x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 60d116b1-febb-4e33-8ff0-08d56b305876 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)(59450400001)(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: 3pARVRv8Moox7DBmb74Zdn31GMVTLjbZ/M4IZrERuidVYt4YjboJF0XlI1i0oa84GKPO1gGZAZcUlQRck/fw9Q== 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: 60d116b1-febb-4e33-8ff0-08d56b305876 X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Feb 2018 18:01:33.2846 (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 cf2acf66ad43abb39735568f55e1f85f9844e990 ] When cleaning up after a partially successful gntdev_mmap(), unmap the successfully mapped grant pages otherwise Xen will kill the domain if in debug mode (Attempt to implicitly unmap a granted PTE) or Linux will kill the process and emit "BUG: Bad page map in process" if Xen is in release mode. This is only needed when use_ptemod is true because gntdev_put_map() will unmap grant pages itself when use_ptemod is false. 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, 3 insertions(+), 1 deletion(-) diff --git a/drivers/xen/gntdev.c b/drivers/xen/gntdev.c index d3391a1e3796..bd56653b9bbc 100644 --- a/drivers/xen/gntdev.c +++ b/drivers/xen/gntdev.c @@ -1071,8 +1071,10 @@ unlock_out: out_unlock_put: mutex_unlock(&priv->lock); out_put_map: - if (use_ptemod) + if (use_ptemod) { map->vma =3D NULL; + unmap_grant_pages(map, 0, map->count); + } gntdev_put_map(priv, map); return err; } --=20 2.11.0