diff options
author | Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> | 2010-01-03 07:16:32 -0500 |
---|---|---|
committer | James Morris <jmorris@namei.org> | 2010-01-10 15:57:44 -0500 |
commit | f737d95ddfea4df68a36ffc9231db4bf34b06d13 (patch) | |
tree | 28a1bf737c96ba8048abcf87a7acfc8412e92a2e /security/tomoyo/domain.c | |
parent | fdb8ebb729bbb640e64028a4f579a02ebc405727 (diff) |
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/domain.c')
-rw-r--r-- | security/tomoyo/domain.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/security/tomoyo/domain.c b/security/tomoyo/domain.c index 2fd190168b7e..7d0b0bc48201 100644 --- a/security/tomoyo/domain.c +++ b/security/tomoyo/domain.c | |||
@@ -58,7 +58,6 @@ struct tomoyo_domain_info tomoyo_kernel_domain; | |||
58 | * exceptions. | 58 | * exceptions. |
59 | */ | 59 | */ |
60 | LIST_HEAD(tomoyo_domain_list); | 60 | LIST_HEAD(tomoyo_domain_list); |
61 | DECLARE_RWSEM(tomoyo_domain_list_lock); | ||
62 | 61 | ||
63 | /* | 62 | /* |
64 | * tomoyo_domain_initializer_entry is a structure which is used for holding | 63 | * tomoyo_domain_initializer_entry is a structure which is used for holding |
@@ -206,7 +205,6 @@ const char *tomoyo_get_last_name(const struct tomoyo_domain_info *domain) | |||
206 | * unless executed from "<kernel> /etc/rc.d/init.d/httpd" domain. | 205 | * unless executed from "<kernel> /etc/rc.d/init.d/httpd" domain. |
207 | */ | 206 | */ |
208 | static LIST_HEAD(tomoyo_domain_initializer_list); | 207 | static LIST_HEAD(tomoyo_domain_initializer_list); |
209 | static DECLARE_RWSEM(tomoyo_domain_initializer_list_lock); | ||
210 | 208 | ||
211 | /** | 209 | /** |
212 | * tomoyo_update_domain_initializer_entry - Update "struct tomoyo_domain_initializer_entry" list. | 210 | * tomoyo_update_domain_initializer_entry - Update "struct tomoyo_domain_initializer_entry" list. |
@@ -247,7 +245,7 @@ static int tomoyo_update_domain_initializer_entry(const char *domainname, | |||
247 | saved_program = tomoyo_save_name(program); | 245 | saved_program = tomoyo_save_name(program); |
248 | if (!saved_program) | 246 | if (!saved_program) |
249 | return -ENOMEM; | 247 | return -ENOMEM; |
250 | down_write(&tomoyo_domain_initializer_list_lock); | 248 | mutex_lock(&tomoyo_policy_lock); |
251 | list_for_each_entry_rcu(ptr, &tomoyo_domain_initializer_list, list) { | 249 | list_for_each_entry_rcu(ptr, &tomoyo_domain_initializer_list, list) { |
252 | if (ptr->is_not != is_not || | 250 | if (ptr->is_not != is_not || |
253 | ptr->domainname != saved_domainname || | 251 | ptr->domainname != saved_domainname || |
@@ -271,7 +269,7 @@ static int tomoyo_update_domain_initializer_entry(const char *domainname, | |||
271 | list_add_tail_rcu(&new_entry->list, &tomoyo_domain_initializer_list); | 269 | list_add_tail_rcu(&new_entry->list, &tomoyo_domain_initializer_list); |
272 | error = 0; | 270 | error = 0; |
273 | out: | 271 | out: |
274 | up_write(&tomoyo_domain_initializer_list_lock); | 272 | mutex_unlock(&tomoyo_policy_lock); |
275 | return error; | 273 | return error; |
276 | } | 274 | } |
277 | 275 | ||
@@ -423,7 +421,6 @@ static bool tomoyo_is_domain_initializer(const struct tomoyo_path_info * | |||
423 | * explicitly specified by "initialize_domain". | 421 | * explicitly specified by "initialize_domain". |
424 | */ | 422 | */ |
425 | static LIST_HEAD(tomoyo_domain_keeper_list); | 423 | static LIST_HEAD(tomoyo_domain_keeper_list); |
426 | static DECLARE_RWSEM(tomoyo_domain_keeper_list_lock); | ||
427 | 424 | ||
428 | /** | 425 | /** |
429 | * tomoyo_update_domain_keeper_entry - Update "struct tomoyo_domain_keeper_entry" list. | 426 | * tomoyo_update_domain_keeper_entry - Update "struct tomoyo_domain_keeper_entry" list. |
@@ -464,7 +461,7 @@ static int tomoyo_update_domain_keeper_entry(const char *domainname, | |||
464 | saved_domainname = tomoyo_save_name(domainname); | 461 | saved_domainname = tomoyo_save_name(domainname); |
465 | if (!saved_domainname) | 462 | if (!saved_domainname) |
466 | return -ENOMEM; | 463 | return -ENOMEM; |
467 | down_write(&tomoyo_domain_keeper_list_lock); | 464 | mutex_lock(&tomoyo_policy_lock); |
468 | list_for_each_entry_rcu(ptr, &tomoyo_domain_keeper_list, list) { | 465 | list_for_each_entry_rcu(ptr, &tomoyo_domain_keeper_list, list) { |
469 | if (ptr->is_not != is_not || | 466 | if (ptr->is_not != is_not || |
470 | ptr->domainname != saved_domainname || | 467 | ptr->domainname != saved_domainname || |
@@ -488,7 +485,7 @@ static int tomoyo_update_domain_keeper_entry(const char *domainname, | |||
488 | list_add_tail_rcu(&new_entry->list, &tomoyo_domain_keeper_list); | 485 | list_add_tail_rcu(&new_entry->list, &tomoyo_domain_keeper_list); |
489 | error = 0; | 486 | error = 0; |
490 | out: | 487 | out: |
491 | up_write(&tomoyo_domain_keeper_list_lock); | 488 | mutex_unlock(&tomoyo_policy_lock); |
492 | return error; | 489 | return error; |
493 | } | 490 | } |
494 | 491 | ||
@@ -624,7 +621,6 @@ static bool tomoyo_is_domain_keeper(const struct tomoyo_path_info *domainname, | |||
624 | * execve() succeeds is calculated using /bin/cat rather than /bin/busybox . | 621 | * execve() succeeds is calculated using /bin/cat rather than /bin/busybox . |
625 | */ | 622 | */ |
626 | static LIST_HEAD(tomoyo_alias_list); | 623 | static LIST_HEAD(tomoyo_alias_list); |
627 | static DECLARE_RWSEM(tomoyo_alias_list_lock); | ||
628 | 624 | ||
629 | /** | 625 | /** |
630 | * tomoyo_update_alias_entry - Update "struct tomoyo_alias_entry" list. | 626 | * tomoyo_update_alias_entry - Update "struct tomoyo_alias_entry" list. |
@@ -654,7 +650,7 @@ static int tomoyo_update_alias_entry(const char *original_name, | |||
654 | saved_aliased_name = tomoyo_save_name(aliased_name); | 650 | saved_aliased_name = tomoyo_save_name(aliased_name); |
655 | if (!saved_original_name || !saved_aliased_name) | 651 | if (!saved_original_name || !saved_aliased_name) |
656 | return -ENOMEM; | 652 | return -ENOMEM; |
657 | down_write(&tomoyo_alias_list_lock); | 653 | mutex_lock(&tomoyo_policy_lock); |
658 | list_for_each_entry_rcu(ptr, &tomoyo_alias_list, list) { | 654 | list_for_each_entry_rcu(ptr, &tomoyo_alias_list, list) { |
659 | if (ptr->original_name != saved_original_name || | 655 | if (ptr->original_name != saved_original_name || |
660 | ptr->aliased_name != saved_aliased_name) | 656 | ptr->aliased_name != saved_aliased_name) |
@@ -675,7 +671,7 @@ static int tomoyo_update_alias_entry(const char *original_name, | |||
675 | list_add_tail_rcu(&new_entry->list, &tomoyo_alias_list); | 671 | list_add_tail_rcu(&new_entry->list, &tomoyo_alias_list); |
676 | error = 0; | 672 | error = 0; |
677 | out: | 673 | out: |
678 | up_write(&tomoyo_alias_list_lock); | 674 | mutex_unlock(&tomoyo_policy_lock); |
679 | return error; | 675 | return error; |
680 | } | 676 | } |
681 | 677 | ||
@@ -745,7 +741,7 @@ struct tomoyo_domain_info *tomoyo_find_or_assign_new_domain(const char * | |||
745 | struct tomoyo_domain_info *domain = NULL; | 741 | struct tomoyo_domain_info *domain = NULL; |
746 | const struct tomoyo_path_info *saved_domainname; | 742 | const struct tomoyo_path_info *saved_domainname; |
747 | 743 | ||
748 | down_write(&tomoyo_domain_list_lock); | 744 | mutex_lock(&tomoyo_policy_lock); |
749 | domain = tomoyo_find_domain(domainname); | 745 | domain = tomoyo_find_domain(domainname); |
750 | if (domain) | 746 | if (domain) |
751 | goto out; | 747 | goto out; |
@@ -792,7 +788,7 @@ struct tomoyo_domain_info *tomoyo_find_or_assign_new_domain(const char * | |||
792 | list_add_tail_rcu(&domain->list, &tomoyo_domain_list); | 788 | list_add_tail_rcu(&domain->list, &tomoyo_domain_list); |
793 | } | 789 | } |
794 | out: | 790 | out: |
795 | up_write(&tomoyo_domain_list_lock); | 791 | mutex_unlock(&tomoyo_policy_lock); |
796 | return domain; | 792 | return domain; |
797 | } | 793 | } |
798 | 794 | ||