Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp324327pxk; Fri, 11 Sep 2020 07:57:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx8dIyOVod34Z/3A/AsjU4SrxpjI8ktNbDcc6bg5zZvhLesw4P6oTCklCO1DmJoxjOBMw+I X-Received: by 2002:aa7:d981:: with SMTP id u1mr2381706eds.250.1599836251641; Fri, 11 Sep 2020 07:57:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599836251; cv=none; d=google.com; s=arc-20160816; b=fYVJdNDMoNbmOw7mlDnYNnOqPlOrNQXn9vfefB6v7ZT7et65w3CybX4+7jKTgcUwjq 5dckLboUMO54fZQuMaSzbwhbYuxhKGAy8Afu00oc6sI72a0pFzQ6SVW8r7jaTnd241Nk KDLdlqFmqJWw+zjVUXlJgglrUpI44O6sWRWlI9VneeDd1PEpAlqTcBDq7Kemc7GIjZDS xaJnePf1p0EUWUixnGblVj90sXztbW6ma8EI5RQaL9k+Kem5/COAVRVi0u8tiPhUQEuw 0ntRp//KkDSeY3hbpaO+8CifJcVBfJVRElxlC3opfAhOdKBp1HHAblRLuHdh9opHihDc ORmA== 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=ni34UtHab1klVs9QqgYi0nujD6fKVEmZpPEwM0TerSE=; b=odT66faDGP7NfqQ3InVco4KTRMcUFGA3gyeE6OXfT5CUqu7pZd3UPxa2d7h653+t+G DQ4PDFImZrsZUlNlxCjwC5V9xaMjlPWSsUsCE8v0c/+0Lspk55ChDag0flqY4j9AnoFM +S3lv3GLzLktygJS1Wf4iutVoJJvjclUlQB5uFlN1kyi/APbdIUYDs7lQNz5El9LhWCP Lpdg1GgvY0NTUD+2RxIqtC2nfMCSVaGFNpYbvwIP2r7SsDFj0lglCSwweJEPkWbnDG0S IllDvIXzgyr5aBw3RrmfIqsIlpPUzyBQyk+oZsTY6EpKCf/m2jXFOMXpVYOb5op4sEVT q24w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=jqlqdABV; 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 q26si1416248eji.610.2020.09.11.07.57.08; Fri, 11 Sep 2020 07:57:31 -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=jqlqdABV; 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 S1726246AbgIKO4R (ORCPT + 99 others); Fri, 11 Sep 2020 10:56:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:52704 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726169AbgIKNCU (ORCPT ); Fri, 11 Sep 2020 09:02:20 -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 4200122285; Fri, 11 Sep 2020 12:57:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599829022; bh=+FACLGKqlSwMrilGYEKodDj+1GCcMCrZAibjV4DcC8U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jqlqdABVSMfvixUedECg0xZ7o5scPS1sxSGWHFbl8W756EovdQXHV0bYa21NhNEDD TASBj7kOYLcZ9rSS0mkEa2OGYa9Sn6rP+ITvv2LmcA2dnjXReTx9JD1YMJYytO4+Mk rFUHJUnqHxO8L228V4yDIDQsjK7uKvUzg0AYld4o= 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.9 08/71] xen/xenbus: Fix granting of vmallocd memory Date: Fri, 11 Sep 2020 14:45:52 +0200 Message-Id: <20200911122505.356407213@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200911122504.928931589@linuxfoundation.org> References: <20200911122504.928931589@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 df27cefb2fa35..266f446ba331c 100644 --- a/drivers/xen/xenbus/xenbus_client.c +++ b/drivers/xen/xenbus/xenbus_client.c @@ -384,8 +384,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