Merge branch 'stable/for-linus-fixes-3.2' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen
* 'stable/for-linus-fixes-3.2' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen: xen-gntalloc: signedness bug in add_grefs() xen-gntalloc: integer overflow in gntalloc_ioctl_alloc() xen-gntdev: integer overflow in gntdev_alloc_map() xen:pvhvm: enable PVHVM VCPU placement when using more than 32 CPUs. xen/balloon: Avoid OOM when requesting highmem xen: Remove hanging references to CONFIG_XEN_PLATFORM_PCI xen: map foreign pages for shared rings by updating the PTEs directly
This commit is contained in:
@@ -454,7 +454,7 @@ void __attribute__((weak)) vmalloc_sync_all(void)
|
||||
* between processes, it syncs the pagetable across all
|
||||
* processes.
|
||||
*/
|
||||
struct vm_struct *alloc_vm_area(size_t size)
|
||||
struct vm_struct *alloc_vm_area(size_t size, pte_t **ptes)
|
||||
{
|
||||
BUG();
|
||||
return NULL;
|
||||
|
27
mm/vmalloc.c
27
mm/vmalloc.c
@@ -2141,23 +2141,30 @@ void __attribute__((weak)) vmalloc_sync_all(void)
|
||||
|
||||
static int f(pte_t *pte, pgtable_t table, unsigned long addr, void *data)
|
||||
{
|
||||
/* apply_to_page_range() does all the hard work. */
|
||||
pte_t ***p = data;
|
||||
|
||||
if (p) {
|
||||
*(*p) = pte;
|
||||
(*p)++;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* alloc_vm_area - allocate a range of kernel address space
|
||||
* @size: size of the area
|
||||
* @ptes: returns the PTEs for the address space
|
||||
*
|
||||
* Returns: NULL on failure, vm_struct on success
|
||||
*
|
||||
* This function reserves a range of kernel address space, and
|
||||
* allocates pagetables to map that range. No actual mappings
|
||||
* are created. If the kernel address space is not shared
|
||||
* between processes, it syncs the pagetable across all
|
||||
* processes.
|
||||
* are created.
|
||||
*
|
||||
* If @ptes is non-NULL, pointers to the PTEs (in init_mm)
|
||||
* allocated for the VM area are returned.
|
||||
*/
|
||||
struct vm_struct *alloc_vm_area(size_t size)
|
||||
struct vm_struct *alloc_vm_area(size_t size, pte_t **ptes)
|
||||
{
|
||||
struct vm_struct *area;
|
||||
|
||||
@@ -2171,19 +2178,11 @@ struct vm_struct *alloc_vm_area(size_t size)
|
||||
* of kernel virtual address space and mapped into init_mm.
|
||||
*/
|
||||
if (apply_to_page_range(&init_mm, (unsigned long)area->addr,
|
||||
area->size, f, NULL)) {
|
||||
size, f, ptes ? &ptes : NULL)) {
|
||||
free_vm_area(area);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* If the allocated address space is passed to a hypercall
|
||||
* before being used then we cannot rely on a page fault to
|
||||
* trigger an update of the page tables. So sync all the page
|
||||
* tables here.
|
||||
*/
|
||||
vmalloc_sync_all();
|
||||
|
||||
return area;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(alloc_vm_area);
|
||||
|
Reference in New Issue
Block a user