[apparmor] [PATCH 31/43] apparmor: fix the locking etc. in the new policy interface

John Johansen john.johansen at canonical.com
Fri Feb 8 21:01:07 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 31ae470..da1d502 100644
--- a/security/apparmor/apparmorfs.c
+++ b/security/apparmor/apparmorfs.c
@@ -412,8 +412,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]);
@@ -454,7 +457,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.7.10.4




More information about the AppArmor mailing list