summaryrefslogtreecommitdiffstats
path: root/security/tomoyo/common.c
diff options
context:
space:
mode:
authorTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>2010-01-03 21:16:32 +0900
committerJames Morris <jmorris@namei.org>2010-01-11 07:57:44 +1100
commitf737d95ddfea4df68a36ffc9231db4bf34b06d13 (patch)
tree28a1bf737c96ba8048abcf87a7acfc8412e92a2e /security/tomoyo/common.c
parentfdb8ebb729bbb640e64028a4f579a02ebc405727 (diff)
downloadblackbird-op-linux-f737d95ddfea4df68a36ffc9231db4bf34b06d13.tar.gz
blackbird-op-linux-f737d95ddfea4df68a36ffc9231db4bf34b06d13.zip
TOMOYO: Replace rw_semaphore by mutex.
Since readers no longer use down_read(), writers no longer need to use rw_semaphore. Replace individual rw_semaphore by single mutex. Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> Acked-by: Serge Hallyn <serue@us.ibm.com> Signed-off-by: James Morris <jmorris@namei.org>
Diffstat (limited to 'security/tomoyo/common.c')
-rw-r--r--security/tomoyo/common.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/security/tomoyo/common.c b/security/tomoyo/common.c
index f01b9364db2d..642e0e565dfc 100644
--- a/security/tomoyo/common.c
+++ b/security/tomoyo/common.c
@@ -16,6 +16,9 @@
#include "common.h"
#include "tomoyo.h"
+/* Lock for protecting policy. */
+DEFINE_MUTEX(tomoyo_policy_lock);
+
/* Has loading policy done? */
bool tomoyo_policy_loaded;
@@ -1086,7 +1089,6 @@ struct tomoyo_policy_manager_entry {
* # cat /sys/kernel/security/tomoyo/manager
*/
static LIST_HEAD(tomoyo_policy_manager_list);
-static DECLARE_RWSEM(tomoyo_policy_manager_list_lock);
/**
* tomoyo_update_manager_entry - Add a manager entry.
@@ -1118,7 +1120,7 @@ static int tomoyo_update_manager_entry(const char *manager,
saved_manager = tomoyo_save_name(manager);
if (!saved_manager)
return -ENOMEM;
- down_write(&tomoyo_policy_manager_list_lock);
+ mutex_lock(&tomoyo_policy_lock);
list_for_each_entry_rcu(ptr, &tomoyo_policy_manager_list, list) {
if (ptr->manager != saved_manager)
continue;
@@ -1138,7 +1140,7 @@ static int tomoyo_update_manager_entry(const char *manager,
list_add_tail_rcu(&new_entry->list, &tomoyo_policy_manager_list);
error = 0;
out:
- up_write(&tomoyo_policy_manager_list_lock);
+ mutex_unlock(&tomoyo_policy_lock);
return error;
}
@@ -1315,7 +1317,7 @@ static int tomoyo_delete_domain(char *domainname)
name.name = domainname;
tomoyo_fill_path_info(&name);
- down_write(&tomoyo_domain_list_lock);
+ mutex_lock(&tomoyo_policy_lock);
/* Is there an active domain? */
list_for_each_entry_rcu(domain, &tomoyo_domain_list, list) {
/* Never delete tomoyo_kernel_domain */
@@ -1327,7 +1329,7 @@ static int tomoyo_delete_domain(char *domainname)
domain->is_deleted = true;
break;
}
- up_write(&tomoyo_domain_list_lock);
+ mutex_unlock(&tomoyo_policy_lock);
return 0;
}
OpenPOWER on IntegriCloud