Received: by 10.223.185.116 with SMTP id b49csp8593838wrg; Fri, 2 Mar 2018 04:43:35 -0800 (PST) X-Google-Smtp-Source: AG47ELsyG3TE5K2fGpSQ7DhymabTXb2+eXaI9q2pk+RqrNa4H7Mc8SP0c5SuQFCl8V38gdpPoNtS X-Received: by 10.99.103.196 with SMTP id b187mr4500831pgc.1.1519994615544; Fri, 02 Mar 2018 04:43:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519994615; cv=none; d=google.com; s=arc-20160816; b=waglcIK8pUby5yERDwz5EzPe2i82dEZltMlbiMMxmVdVD1GMZk9TJVHs7hdO5HeW10 Ti3eN9ZYLAgQnjJnqXd3wVFvX7MGP2tFYuhzlMSbwQm3FWGoCiLktSbUQuzNc7YHVDLG dzceiMDmvDz9tc6JKHX4d6lBh2WeTDDZI7PTQAY1ckdZdzX9v2x4TiMBcRZK2D27njBP RkONanCQJAI7Okjl1SJm1NoyienQvBgQKxYyrD0vfhEZHnY2VMgo0SEhEk+YS70vp6pl 3u8eyn5ITuG7znN9rq1a0JXljiPCqgblQijoVE/okrOc4kMwKAdesI3OdVU8bf+nUCuX jVDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=p2H0+9K05zSha6XjdJ4PnDIb/HJ0Jj3F38eNuk4+51I=; b=J5EOKtiTqXH3wxcwVHw88KujvNJQdecRwP3JfLzj2KCv6kg70U1+/jE2/bKasSFVF2 1znltDuFoD7Y/wHARlM/aJRLkg6VsnoYwG2EdT9hsQfgN7S9232T4ZVVVEQmbLWEgyw+ sP77BfDpOyu41xS/KxW6S+nv/OXZrBFwzXRuakxVXGCarzHHSSrFcsZqzYrkAjwtSVzw ZVQenYS5MPyZYBXaBh1zfTWuf84YS0f9qSXJu0mUbUHEyWxj9x1BK0ezXRK9Lhg2aODC 1dQS5zQuMFOT91KRmgp7zemuMiRSzDZse1KhiKuddfg1OLGUpmvEOzIHzHVxZtl1qWst Nr3w== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o12-v6si3431509plg.468.2018.03.02.04.43.20; Fri, 02 Mar 2018 04:43:35 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1423743AbeCBIzs (ORCPT + 99 others); Fri, 2 Mar 2018 03:55:48 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:50882 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1423712AbeCBIzq (ORCPT ); Fri, 2 Mar 2018 03:55:46 -0500 Received: from localhost (clnet-b04-243.ikbnet.co.at [83.175.124.243]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id F38561255; Fri, 2 Mar 2018 08:55:45 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ross Lagerwall , Boris Ostrovsky , Sasha Levin Subject: [PATCH 4.4 31/34] xen/gntdev: Fix partial gntdev_mmap() cleanup Date: Fri, 2 Mar 2018 09:51:27 +0100 Message-Id: <20180302084438.008379826@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180302084435.842679610@linuxfoundation.org> References: <20180302084435.842679610@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ 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 Signed-off-by: Greg Kroah-Hartman --- drivers/xen/gntdev.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/xen/gntdev.c +++ b/drivers/xen/gntdev.c @@ -874,8 +874,10 @@ unlock_out: out_unlock_put: mutex_unlock(&priv->lock); out_put_map: - if (use_ptemod) + if (use_ptemod) { map->vma = NULL; + unmap_grant_pages(map, 0, map->count); + } gntdev_put_map(priv, map); return err; }