mm: vm: Add loop detect and fix loop in vm_range

Signed-off-by: Bart Kuivenhoven <bemkuivenhoven@gmail.com>