summaryrefslogtreecommitdiffstats
path: root/sys/fs/procfs/procfs_mem.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/fs/procfs/procfs_mem.c')
-rw-r--r--sys/fs/procfs/procfs_mem.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/sys/fs/procfs/procfs_mem.c b/sys/fs/procfs/procfs_mem.c
index b8c60d6..e109146 100644
--- a/sys/fs/procfs/procfs_mem.c
+++ b/sys/fs/procfs/procfs_mem.c
@@ -83,6 +83,8 @@ procfs_rwmem(curp, p, uio)
vm_prot_t reqprot;
vm_offset_t kva;
+ GIANT_REQUIRED;
+
/*
* if the vmspace is in the midst of being deallocated or the
* process is exiting, don't try to grab anything. The page table
@@ -91,12 +93,8 @@ procfs_rwmem(curp, p, uio)
vm = p->p_vmspace;
if ((p->p_flag & P_WEXIT))
return EFAULT;
-
- mtx_lock(&vm_mtx);
- if (vm->vm_refcnt < 1) {
- mtx_unlock(&vm_mtx);
+ if (vm->vm_refcnt < 1)
return EFAULT;
- }
++vm->vm_refcnt;
/*
* The map we want...
@@ -214,9 +212,7 @@ procfs_rwmem(curp, p, uio)
/*
* Now do the i/o move.
*/
- mtx_unlock(&vm_mtx);
error = uiomove((caddr_t)(kva + page_offset), len, uio);
- mtx_lock(&vm_mtx);
pmap_kremove(kva);
@@ -235,7 +231,6 @@ procfs_rwmem(curp, p, uio)
kmem_free(kernel_map, kva, PAGE_SIZE);
vmspace_free(vm);
- mtx_unlock(&vm_mtx);
return (error);
}
OpenPOWER on IntegriCloud