[apparmor] [PATCH 13/36] apparmor: fix the locking etc. in the new policy interface

John Johansen john.johansen at canonical.com
Wed May 1 21:30:58 UTC 2013


Signed-off-by: John Johansen <john.johansen at canonical.com>
---
 security/apparmor/apparmorfs.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c
index b079cea..bfc8015 100644
--- a/security/apparmor/apparmorfs.c
+++ b/security/apparmor/apparmorfs.c
@@ -413,8 +413,11 @@ void __aa_fs_namespace_rmdir(struct aa_namespace *ns)
 	list_for_each_entry(child, &ns->base.profiles, base.list)
 		__aa_fs_profile_rmdir(child);
 
-	list_for_each_entry(sub, &ns->sub_ns, base.list)
+	list_for_each_entry(sub, &ns->sub_ns, base.list) {
+		mutex_lock(&sub->lock);
 		__aa_fs_namespace_rmdir(sub);
+		mutex_unlock(&sub->lock);
+	}
 
 	for (i = AAFS_NS_SIZEOF - 1; i >= 0 ; --i) {
 		securityfs_remove(ns->dents[i]);
@@ -455,7 +458,9 @@ int __aa_fs_namespace_mkdir(struct aa_namespace *ns, struct dentry *parent,
 	}
 
 	list_for_each_entry(sub, &ns->sub_ns, base.list) {
+		mutex_lock(&sub->lock);
 		error = __aa_fs_namespace_mkdir(sub, ns_subns_dir(ns), NULL);
+		mutex_unlock(&sub->lock);
 		if (error)
 			goto fail2;
 	}
-- 
1.8.1.2




More information about the AppArmor mailing list