Skip to content

Commit b0576cc

Browse files
committed
xen/pvcalls: use alloc/free_pages_exact()
Instead of __get_free_pages() and free_pages() use alloc_pages_exact() and free_pages_exact(). This is in preparation of a change of gnttab_end_foreign_access() which will prohibit use of high-order pages. This is part of CVE-2022-23041 / XSA-396. Reported-by: Simon Gaiser <[email protected]> Signed-off-by: Juergen Gross <[email protected]> Reviewed-by: Jan Beulich <[email protected]> --- V4: - new patch
1 parent 5cadd4b commit b0576cc

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/xen/pvcalls-front.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -337,8 +337,8 @@ static void free_active_ring(struct sock_mapping *map)
337337
if (!map->active.ring)
338338
return;
339339

340-
free_pages((unsigned long)map->active.data.in,
341-
map->active.ring->ring_order);
340+
free_pages_exact(map->active.data.in,
341+
PAGE_SIZE << map->active.ring->ring_order);
342342
free_page((unsigned long)map->active.ring);
343343
}
344344

@@ -352,8 +352,8 @@ static int alloc_active_ring(struct sock_mapping *map)
352352
goto out;
353353

354354
map->active.ring->ring_order = PVCALLS_RING_ORDER;
355-
bytes = (void *)__get_free_pages(GFP_KERNEL | __GFP_ZERO,
356-
PVCALLS_RING_ORDER);
355+
bytes = alloc_pages_exact(PAGE_SIZE << PVCALLS_RING_ORDER,
356+
GFP_KERNEL | __GFP_ZERO);
357357
if (!bytes)
358358
goto out;
359359

0 commit comments

Comments
 (0)