mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-03-24 16:15:29 +00:00
vmalloc: unmap vmalloc area after hiding it
vmap area should be purged after vm_struct is removed from the list because vread/vwrite etc...believes the range is valid while it's on vm_struct list. Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Reviewed-by: WANG Cong <xiyou.wangcong@gmail.com> Cc: Mike Smith <scgtrp@gmail.com> Cc: Nick Piggin <nickpiggin@yahoo.com.au> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
2f66a68f3f
commit
dd32c27998
1 changed files with 9 additions and 5 deletions
14
mm/vmalloc.c
14
mm/vmalloc.c
|
@ -1270,17 +1270,21 @@ struct vm_struct *remove_vm_area(const void *addr)
|
||||||
if (va && va->flags & VM_VM_AREA) {
|
if (va && va->flags & VM_VM_AREA) {
|
||||||
struct vm_struct *vm = va->private;
|
struct vm_struct *vm = va->private;
|
||||||
struct vm_struct *tmp, **p;
|
struct vm_struct *tmp, **p;
|
||||||
|
/*
|
||||||
vmap_debug_free_range(va->va_start, va->va_end);
|
* remove from list and disallow access to this vm_struct
|
||||||
free_unmap_vmap_area(va);
|
* before unmap. (address range confliction is maintained by
|
||||||
vm->size -= PAGE_SIZE;
|
* vmap.)
|
||||||
|
*/
|
||||||
write_lock(&vmlist_lock);
|
write_lock(&vmlist_lock);
|
||||||
for (p = &vmlist; (tmp = *p) != vm; p = &tmp->next)
|
for (p = &vmlist; (tmp = *p) != vm; p = &tmp->next)
|
||||||
;
|
;
|
||||||
*p = tmp->next;
|
*p = tmp->next;
|
||||||
write_unlock(&vmlist_lock);
|
write_unlock(&vmlist_lock);
|
||||||
|
|
||||||
|
vmap_debug_free_range(va->va_start, va->va_end);
|
||||||
|
free_unmap_vmap_area(va);
|
||||||
|
vm->size -= PAGE_SIZE;
|
||||||
|
|
||||||
return vm;
|
return vm;
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
Loading…
Add table
Reference in a new issue