Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp3702250ybv; Mon, 10 Feb 2020 05:00:36 -0800 (PST) X-Google-Smtp-Source: APXvYqyXGzDHdmhkTJ7mq73mAwuRj6xJwFu3Nh30eMbn7eDp9TZUtjazqFChCu8y8l8Ki1jZuqiY X-Received: by 2002:aca:c4d2:: with SMTP id u201mr763850oif.54.1581339636693; Mon, 10 Feb 2020 05:00:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581339636; cv=none; d=google.com; s=arc-20160816; b=IfPRXm6xKTNuWOz8lo2FyZD58w8KqV1JqpkPigkP0xcxiJ3zLhPCqWAhmKVUdJJIrp r/PSKJ8T6VH49WCdTtVSLMDiA7K8i2HRHSK5xlNPHEtqYQm3rshrrEV43qp8sGxE5g7Q kk9iOhraMMLAeUCa6WzyUXEln6yPSWGqGtJ2d2S/1Z/GerR3Rh5iLhx2PbHmz2fCP7sG /3FFulFE2cA9nBCxIUh6OJBiUMOf4oo7iQlA1tbPiRW4NOlHkOwBKVDl8NFechblzuy2 k8wWCZbIjZnzUnSVMqiukSqWVsYHxw1EneBmCBOY6fDteVGqzMd1bgc/7c9CFyRU/MJ4 grmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=p5nkPualwZpIwm6iZ6ApAhRgVfTCD7dbs9w0W9IcFNQ=; b=zrDanHhMTc4QCxqYOIXq7ku/r+r+HpoRdL37HeJOyXpAe+rbculSHPu1I/g5ECxrrr N46GoOeyv0xn5/0RrV1UwGkwbW3VprlaXlKOyVcZs0q2akAKVbO8OVegrMncl/2oFK/B BAVqWhZC+KftsoBWGK0w2Y7Zuq+/ed4q5saPXDTmI7VI1zqRMnkJErTCbGa7yuhbaI+u 2sPeiO2vT5LKR2azvgz73t5I6SzOjxLAd7tB4kwY11a1l8g4bBFoPzN2mII4y2h0qmAf uIMjHXx0AwO8VOCXqHwPNXnltEMjPDFQhnVNteCzvuHM/E/r2Q9qLuRUp4jO6UBLvLFI JSjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=IrBblcVB; 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 b25si158726otp.212.2020.02.10.05.00.23; Mon, 10 Feb 2020 05:00:36 -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=@kernel.org header.s=default header.b=IrBblcVB; 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 S1729394AbgBJNAI (ORCPT + 99 others); Mon, 10 Feb 2020 08:00:08 -0500 Received: from mail.kernel.org ([198.145.29.99]:42010 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729867AbgBJMlC (ORCPT ); Mon, 10 Feb 2020 07:41:02 -0500 Received: from localhost (unknown [209.37.97.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 25E6B2468F; Mon, 10 Feb 2020 12:41:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581338462; bh=OCXjpcJpebivRUQpaM+0Km+GDYQ/m8mDsaaF8Z1eFUQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IrBblcVBunTNLSvF2B2udssEK8UhgramC7dntri0yhvNi2H+bp2o06t2RNydxOth4 lHRLq+QJx67odrYSuuOdAuGTmX/6Fx5yuuYc9vuOBZ5ypyeaYLHMGDzhq28+XJRPww O4vJSIQwFSnh2cCjxn5pBJvZE8/eJnR0efN+JDdI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , Boris Ostrovsky , Jason Gunthorpe , Juergen Gross Subject: [PATCH 5.5 220/367] xen/gntdev: Do not use mm notifiers with autotranslating guests Date: Mon, 10 Feb 2020 04:32:13 -0800 Message-Id: <20200210122444.421413856@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200210122423.695146547@linuxfoundation.org> References: <20200210122423.695146547@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Boris Ostrovsky commit 9293724192a73f49c722e9685d45649c6df67dfe upstream. Commit d3eeb1d77c5d ("xen/gntdev: use mmu_interval_notifier_insert") missed a test for use_ptemod when calling mmu_interval_read_begin(). Fix that. Fixes: d3eeb1d77c5d ("xen/gntdev: use mmu_interval_notifier_insert") CC: stable@vger.kernel.org # 5.5 Reported-by: Ilpo Järvinen Tested-by: Ilpo Järvinen Signed-off-by: Boris Ostrovsky Reviewed-by: Jason Gunthorpe Acked-by: Juergen Gross Signed-off-by: Greg Kroah-Hartman --- drivers/xen/gntdev.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) --- a/drivers/xen/gntdev.c +++ b/drivers/xen/gntdev.c @@ -1006,19 +1006,19 @@ static int gntdev_mmap(struct file *flip } mutex_unlock(&priv->lock); - /* - * gntdev takes the address of the PTE in find_grant_ptes() and passes - * it to the hypervisor in gntdev_map_grant_pages(). The purpose of - * the notifier is to prevent the hypervisor pointer to the PTE from - * going stale. - * - * Since this vma's mappings can't be touched without the mmap_sem, - * and we are holding it now, there is no need for the notifier_range - * locking pattern. - */ - mmu_interval_read_begin(&map->notifier); - if (use_ptemod) { + /* + * gntdev takes the address of the PTE in find_grant_ptes() and + * passes it to the hypervisor in gntdev_map_grant_pages(). The + * purpose of the notifier is to prevent the hypervisor pointer + * to the PTE from going stale. + * + * Since this vma's mappings can't be touched without the + * mmap_sem, and we are holding it now, there is no need for + * the notifier_range locking pattern. + */ + mmu_interval_read_begin(&map->notifier); + map->pages_vm_start = vma->vm_start; err = apply_to_page_range(vma->vm_mm, vma->vm_start, vma->vm_end - vma->vm_start,