Skip to content
This repository was archived by the owner on Dec 20, 2023. It is now read-only.

Commit 7d951f3

Browse files
author
David Vrabel
committed
x86/xen: use vmap() to map grant table pages in PVH guests
Commit b7dd0e3 (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: David Vrabel <[email protected]> Reported-by: Mukesh Rathor <[email protected]> Tested-by: Mukesh Rathor <[email protected]> Cc: [email protected]
1 parent 8d5999d commit 7d951f3

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

arch/x86/xen/grant-table.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ static int __init xlated_setup_gnttab_pages(void)
118118
{
119119
struct page **pages;
120120
xen_pfn_t *pfns;
121+
void *vaddr;
121122
int rc;
122123
unsigned int i;
123124
unsigned long nr_grant_frames = gnttab_max_grant_frames();
@@ -143,21 +144,20 @@ static int __init xlated_setup_gnttab_pages(void)
143144
for (i = 0; i < nr_grant_frames; i++)
144145
pfns[i] = page_to_pfn(pages[i]);
145146

146-
rc = arch_gnttab_map_shared(pfns, nr_grant_frames, nr_grant_frames,
147-
&xen_auto_xlat_grant_frames.vaddr);
148-
149-
if (rc) {
147+
vaddr = vmap(pages, nr_grant_frames, 0, PAGE_KERNEL);
148+
if (!vaddr) {
150149
pr_warn("%s Couldn't map %ld pfns rc:%d\n", __func__,
151150
nr_grant_frames, rc);
152151
free_xenballooned_pages(nr_grant_frames, pages);
153152
kfree(pages);
154153
kfree(pfns);
155-
return rc;
154+
return -ENOMEM;
156155
}
157156
kfree(pages);
158157

159158
xen_auto_xlat_grant_frames.pfn = pfns;
160159
xen_auto_xlat_grant_frames.count = nr_grant_frames;
160+
xen_auto_xlat_grant_frames.vaddr = vaddr;
161161

162162
return 0;
163163
}

0 commit comments

Comments
 (0)