summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2014-02-04 19:06:01 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2014-02-04 19:06:44 +0100
commit3bc572030b864b2ef922325b7e4ed85a7c178200 (patch)
tree98bf825b37eb84fd1a51219b51c31f49f726f514
parentd1435c2e91ed9146acd4b0d10e6a892dc79e67be (diff)
Fix potential NULL dereference
* vm/vm_kern.c (projected_buffer_deallocate): Look for `map' being NULL or kernel_map before locking it.
-rw-r--r--vm/vm_kern.c6
1 files changed, 4 insertions, 2 deletions
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) {