Commit 7d951f3c authored by David Vrabel's avatar David Vrabel

x86/xen: use vmap() to map grant table pages in PVH guests

Commit b7dd0e35 (x86/xen: safely map and unmap grant frames when
in atomic context) causes PVH guests to crash in
arch_gnttab_map_shared() when they attempted to map the pages for the
grant table.

This use of a PV-specific function during the PVH grant table setup is
non-obvious and not needed.  The standard vmap() function does the
right thing.
Signed-off-by: default avatarDavid Vrabel <david.vrabel@citrix.com>
Reported-by: default avatarMukesh Rathor <mukesh.rathor@oracle.com>
Tested-by: default avatarMukesh Rathor <mukesh.rathor@oracle.com>
Cc: stable@vger.kernel.org
parent 8d5999df
...@@ -118,6 +118,7 @@ static int __init xlated_setup_gnttab_pages(void) ...@@ -118,6 +118,7 @@ static int __init xlated_setup_gnttab_pages(void)
{ {
struct page **pages; struct page **pages;
xen_pfn_t *pfns; xen_pfn_t *pfns;
void *vaddr;
int rc; int rc;
unsigned int i; unsigned int i;
unsigned long nr_grant_frames = gnttab_max_grant_frames(); unsigned long nr_grant_frames = gnttab_max_grant_frames();
...@@ -143,21 +144,20 @@ static int __init xlated_setup_gnttab_pages(void) ...@@ -143,21 +144,20 @@ static int __init xlated_setup_gnttab_pages(void)
for (i = 0; i < nr_grant_frames; i++) for (i = 0; i < nr_grant_frames; i++)
pfns[i] = page_to_pfn(pages[i]); pfns[i] = page_to_pfn(pages[i]);
rc = arch_gnttab_map_shared(pfns, nr_grant_frames, nr_grant_frames, vaddr = vmap(pages, nr_grant_frames, 0, PAGE_KERNEL);
&xen_auto_xlat_grant_frames.vaddr); if (!vaddr) {
if (rc) {
pr_warn("%s Couldn't map %ld pfns rc:%d\n", __func__, pr_warn("%s Couldn't map %ld pfns rc:%d\n", __func__,
nr_grant_frames, rc); nr_grant_frames, rc);
free_xenballooned_pages(nr_grant_frames, pages); free_xenballooned_pages(nr_grant_frames, pages);
kfree(pages); kfree(pages);
kfree(pfns); kfree(pfns);
return rc; return -ENOMEM;
} }
kfree(pages); kfree(pages);
xen_auto_xlat_grant_frames.pfn = pfns; xen_auto_xlat_grant_frames.pfn = pfns;
xen_auto_xlat_grant_frames.count = nr_grant_frames; xen_auto_xlat_grant_frames.count = nr_grant_frames;
xen_auto_xlat_grant_frames.vaddr = vaddr;
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment