kernel - Fix missing token release in msync() error path
authorMatthew Dillon <dillon@apollo.backplane.com>
Mon, 31 Oct 2011 18:16:59 +0000 (11:16 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Mon, 31 Oct 2011 18:16:59 +0000 (11:16 -0700)
* Fix a missing token release in the msync() error path that would lead
  to a panic in the syscall return code.

Reported-by: swildner
sys/vm/vm_map.c

index 437de34..033cc0f 100644 (file)
@@ -2472,12 +2472,14 @@ vm_map_clean(vm_map_t map, vm_offset_t start, vm_offset_t end,
         */
        for (current = entry; current->start < end; current = current->next) {
                if (current->maptype == VM_MAPTYPE_SUBMAP) {
+                       lwkt_reltoken(&map->token);
                        vm_map_unlock_read(map);
                        return (KERN_INVALID_ARGUMENT);
                }
                if (end > current->end &&
                    (current->next == &map->header ||
                        current->end != current->next->start)) {
+                       lwkt_reltoken(&map->token);
                        vm_map_unlock_read(map);
                        return (KERN_INVALID_ADDRESS);
                }