From 3bc572030b864b2ef922325b7e4ed85a7c178200 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Tue, 4 Feb 2014 19:06:01 +0100 Subject: Fix potential NULL dereference * vm/vm_kern.c (projected_buffer_deallocate): Look for `map' being NULL or kernel_map before locking it. --- vm/vm_kern.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'vm') diff --git a/vm/vm_kern.c b/vm/vm_kern.c index 1c843ff..62edbc5 100644 --- a/vm/vm_kern.c +++ b/vm/vm_kern.c @@ -256,9 +256,11 @@ projected_buffer_deallocate(map, start, end) { vm_map_entry_t entry, k_entry; + if (map == VM_MAP_NULL || map == kernel_map) + return KERN_INVALID_ARGUMENT; + vm_map_lock(map); - if (map == VM_MAP_NULL || map == kernel_map || - !vm_map_lookup_entry(map, start, &entry) || + if (!vm_map_lookup_entry(map, start, &entry) || end > entry->vme_end || /*Check corresponding kernel entry*/ (k_entry = entry->projected_on) == 0) { -- cgit v1.2.3