diff options
author | csjp <csjp@FreeBSD.org> | 2005-10-09 02:37:27 +0000 |
---|---|---|
committer | csjp <csjp@FreeBSD.org> | 2005-10-09 02:37:27 +0000 |
commit | 63c5e35623e13a5dc8afe4396c0b47dbd7007444 (patch) | |
tree | 404569a8a9aec6ba98bc62954c5f7da011f9c3aa | |
parent | 39c85cfe13a7ad16ba73b9e2d29e3e043c3c8715 (diff) | |
download | FreeBSD-src-63c5e35623e13a5dc8afe4396c0b47dbd7007444.zip FreeBSD-src-63c5e35623e13a5dc8afe4396c0b47dbd7007444.tar.gz |
Lock object while we iterate through it's backing objects.
Discussed with: alc
-rw-r--r-- | sys/security/mac/mac_process.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/sys/security/mac/mac_process.c b/sys/security/mac/mac_process.c index 67bda6f..9b72cbd 100644 --- a/sys/security/mac/mac_process.c +++ b/sys/security/mac/mac_process.c @@ -327,7 +327,7 @@ mac_cred_mmapped_drop_perms_recurse(struct thread *td, struct ucred *cred, struct vm_map_entry *vme; int vfslocked, result; vm_prot_t revokeperms; - vm_object_t object; + vm_object_t backing_object, object; vm_ooffset_t offset; struct vnode *vp; @@ -354,13 +354,14 @@ mac_cred_mmapped_drop_perms_recurse(struct thread *td, struct ucred *cred, object = vme->object.vm_object; if (object == NULL) continue; - /* XXXCSJP We need to lock the object before walking - * the backing object list. - */ - while (object->backing_object != NULL) { + VM_OBJECT_LOCK(object); + while ((backing_object = object->backing_object) != NULL) { + VM_OBJECT_LOCK(backing_object); offset += object->backing_object_offset; - object = object->backing_object; + VM_OBJECT_UNLOCK(object); + object = backing_object; } + VM_OBJECT_UNLOCK(object); /* * At the moment, vm_maps and objects aren't considered * by the MAC system, so only things with backing by a |