Commit b0576cc9 authored by Juergen Gross's avatar Juergen Gross

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: default avatarSimon Gaiser <simon@invisiblethingslab.com>
Signed-off-by: default avatarJuergen Gross <jgross@suse.com>
Reviewed-by: default avatarJan Beulich <jbeulich@suse.com>
---
V4:
- new patch
parent 5cadd4bb
...@@ -337,8 +337,8 @@ static void free_active_ring(struct sock_mapping *map) ...@@ -337,8 +337,8 @@ static void free_active_ring(struct sock_mapping *map)
if (!map->active.ring) if (!map->active.ring)
return; return;
free_pages((unsigned long)map->active.data.in, free_pages_exact(map->active.data.in,
map->active.ring->ring_order); PAGE_SIZE << map->active.ring->ring_order);
free_page((unsigned long)map->active.ring); free_page((unsigned long)map->active.ring);
} }
...@@ -352,8 +352,8 @@ static int alloc_active_ring(struct sock_mapping *map) ...@@ -352,8 +352,8 @@ static int alloc_active_ring(struct sock_mapping *map)
goto out; goto out;
map->active.ring->ring_order = PVCALLS_RING_ORDER; map->active.ring->ring_order = PVCALLS_RING_ORDER;
bytes = (void *)__get_free_pages(GFP_KERNEL | __GFP_ZERO, bytes = alloc_pages_exact(PAGE_SIZE << PVCALLS_RING_ORDER,
PVCALLS_RING_ORDER); GFP_KERNEL | __GFP_ZERO);
if (!bytes) if (!bytes)
goto out; goto out;
......
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