History

mm: vmalloc: don't remove inexistent guard hole in remove_vm_area()

Commit 71394fe50146 ("mm: vmalloc: add flag preventing guard hole allocation") missed a spot. Currently remove_vm_area() decreases vm->size to "remove" the guard hole page, even when it isn't present. All but one users just free the vm_struct rigth away and never access vm->size anyway. Don't touch the size in remove_vm_area() and have __vunmap() use the proper get_vm_area_size() helper.

Jerome Marchand committed 10 years ago

Commit 7511c3e1 parent 429d4861 file · +2 −3Browse files

Showing the changes to mm/vmalloc.c (1 of 1 file). Show all

Unified · Split

mm/vmalloc.c+2−3
@@ -1443,7 +1443,6 @@ struct vm_struct *remove_vm_area(const void *addr) · 1442 unmodified lines
14431443 vmap_debug_free_range(va->va_start, va->va_end);
14441444 kasan_free_shadow(vm);
14451445 free_unmap_vmap_area(va);
1446− vm->size -= PAGE_SIZE;
14471446
14481447 return vm;
14491448 }
@@ -1468,8 +1467,8 @@ static void __vunmap(const void *addr, int deallocate_pages) · 18 unmodified lines
14681467 return;
14691468 }
14701469
1471− debug_check_no_locks_freed(addr, area->size);
1472− debug_check_no_obj_freed(addr, area->size);
1470+ debug_check_no_locks_freed(addr, get_vm_area_size(area));
1471+ debug_check_no_obj_freed(addr, get_vm_area_size(area));
14731472
14741473 if (deallocate_pages) {
14751474 int i;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t