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.
Unified · Split
| @@ -1443,7 +1443,6 @@ struct vm_struct *remove_vm_area(const void *addr) · 1442 unmodified lines | |||
| 1443 | vmap_debug_free_range(va->va_start, va->va_end); | 1443 | vmap_debug_free_range(va->va_start, va->va_end); |
| 1444 | kasan_free_shadow(vm); | 1444 | kasan_free_shadow(vm); |
| 1445 | free_unmap_vmap_area(va); | 1445 | free_unmap_vmap_area(va); |
| 1446 | vm->size -= PAGE_SIZE; | ||
| 1447 | 1446 | ||
| 1448 | return vm; | 1447 | return vm; |
| 1449 | } | 1448 | } |
| @@ -1468,8 +1467,8 @@ static void __vunmap(const void *addr, int deallocate_pages) · 18 unmodified lines | |||
| 1468 | return; | 1467 | return; |
| 1469 | } | 1468 | } |
| 1470 | 1469 | ||
| 1471 | debug_check_no_locks_freed(addr, area->size); | 1470 | debug_check_no_locks_freed(addr, get_vm_area_size(area)); |
| 1472 | debug_check_no_obj_freed(addr, area->size); | 1471 | debug_check_no_obj_freed(addr, get_vm_area_size(area)); |
| 1473 | 1472 | ||
| 1474 | if (deallocate_pages) { | 1473 | if (deallocate_pages) { |
| 1475 | int i; | 1474 | int i; |