Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp4116897pxk; Tue, 8 Sep 2020 11:07:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwBd1mRjDNtk4VT5lz5UVYo1YCQmRtlgtjF2AlRFnbcsRA27c9WQ7SSJZjqCWxdmCmZublI X-Received: by 2002:a50:bb65:: with SMTP id y92mr175884ede.53.1599588437026; Tue, 08 Sep 2020 11:07:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599588437; cv=none; d=google.com; s=arc-20160816; b=MB5Ayx6lquCxrcZx4mg4unmpX3yBHArj5JqqGJoR84anfRjUtd+Bt9oE6YK5pEEkHn moYKEKqCxi6GGtPLqpkRN/XSWlDE9wiZZS4zPh6RMrosS5p3HpCBZ0Ja7BCAdb4XUS3P j497Mb/NGqfPhvBJ2QY41jnmp37SHip9LpiQgk5Pb2JbqHMLqSgFeRZKrvI4wDhr3y6P 6WoUXOfvFnBz5+c+uUx874+wiyNKpk7+tOoyoTkBOXMmZAh9k5URLb+a0j9eoD2lJSVY 4+ekpTwx/wgNg4BuR+eNi7j5bgeK8sijl+iCh+Jjbfy9Bc/E9/SHTXVgTmE1FD76cBTz qXyQ== 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=HH0AHrlfdHskKFpxMvzL9NeQYfJ7k03Cfm4efH52tE4=; b=mM4plhrwXGcooZh8B2+CEqGyynYjIpm+CrMuTWXJC7rTm0cnluEx6MX4QOWoRp/GB+ icNuo6nvtfyGBPEbQ1Oda7k7ip1WTlX8TIpYA+/kSYni9T/LeoCHnOkllQzn0/FSlU1s n7RG49mp9DbzxzcWnCGcqz/2VkRz4Li/xbMOn0J5yRVEa8o2xIoOPWvNfHORfQ4E6EsU DZIvGY0Eh+U3XP5V5GLsSz4layoC3/C9aWnk2yTOw8ZSNicL1QAMlWbLczIbtwog2/BT h/ixcnHKzBKpmpGuNmpcnd4+vOGahviouc0WpqcCkoO3P+4tFQjaBuRMLexxxAE/WxxS OO5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=UQVppZgm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b20si13512812edn.57.2020.09.08.11.06.54; Tue, 08 Sep 2020 11:07:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=UQVppZgm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731717AbgIHSFb (ORCPT + 99 others); Tue, 8 Sep 2020 14:05:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:55372 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730924AbgIHQMK (ORCPT ); Tue, 8 Sep 2020 12:12:10 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 64EC424793; Tue, 8 Sep 2020 15:51:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599580274; bh=h6ks64jl06DbIv9dD4cgt72UfJdgdym0WvGOZh3FOfA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UQVppZgmqYt1iIPPpcyE39Ow0d4BKolVPHmohtfsxG/JC/XVVubEtxY41BiXuf361 yGxBjux8VTb3kYdEnWyo+Q/4x9787jl0fza7BWUIVMLDXac7diJRi33QsLpEfne9nl d/VxmRD903y8OE+Zziuc7La8rCcG/3HIy2DcmgIs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Simon Leiner , Stefano Stabellini , Juergen Gross , Sasha Levin Subject: [PATCH 4.14 10/65] xen/xenbus: Fix granting of vmallocd memory Date: Tue, 8 Sep 2020 17:25:55 +0200 Message-Id: <20200908152217.556133019@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200908152217.022816723@linuxfoundation.org> References: <20200908152217.022816723@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: Simon Leiner [ Upstream commit d742db70033c745e410523e00522ee0cfe2aa416 ] On some architectures (like ARM), virt_to_gfn cannot be used for vmalloc'd memory because of its reliance on virt_to_phys. This patch introduces a check for vmalloc'd addresses and obtains the PFN using vmalloc_to_pfn in that case. Signed-off-by: Simon Leiner Reviewed-by: Stefano Stabellini Link: https://lore.kernel.org/r/20200825093153.35500-1-simon@leiner.me Signed-off-by: Juergen Gross Signed-off-by: Sasha Levin --- drivers/xen/xenbus/xenbus_client.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/xen/xenbus/xenbus_client.c b/drivers/xen/xenbus/xenbus_client.c index e94a61eaeceb0..f7b553faadb10 100644 --- a/drivers/xen/xenbus/xenbus_client.c +++ b/drivers/xen/xenbus/xenbus_client.c @@ -365,8 +365,14 @@ int xenbus_grant_ring(struct xenbus_device *dev, void *vaddr, int i, j; for (i = 0; i < nr_pages; i++) { - err = gnttab_grant_foreign_access(dev->otherend_id, - virt_to_gfn(vaddr), 0); + unsigned long gfn; + + if (is_vmalloc_addr(vaddr)) + gfn = pfn_to_gfn(vmalloc_to_pfn(vaddr)); + else + gfn = virt_to_gfn(vaddr); + + err = gnttab_grant_foreign_access(dev->otherend_id, gfn, 0); if (err < 0) { xenbus_dev_fatal(dev, err, "granting access to ring page"); -- 2.25.1