diff options
author | Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> | 2011-06-26 10:16:36 -0400 |
---|---|---|
committer | James Morris <jmorris@namei.org> | 2011-06-28 19:31:19 -0400 |
commit | 0df7e8b8f1c25c10820bdc679555f2fbfb897ca0 (patch) | |
tree | 626a0304fceec0bbee93e43a24bc0f813fe230b7 /security/tomoyo/domain.c | |
parent | b5bc60b4ce313b6dbb42e7d32915dcf0a07c2a68 (diff) |
TOMOYO: Cleanup part 3.
Use common structure for ACL with "struct list_head" + "atomic_t".
Use array/struct where possible.
Remove is_group from "struct tomoyo_name_union"/"struct tomoyo_number_union".
Pass "struct file"->private_data rather than "struct file".
Update some of comments.
Bring tomoyo_same_acl_head() from common.h to domain.c .
Bring tomoyo_invalid()/tomoyo_valid() from common.h to util.c .
Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: James Morris <jmorris@namei.org>
Diffstat (limited to 'security/tomoyo/domain.c')
-rw-r--r-- | security/tomoyo/domain.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/security/tomoyo/domain.c b/security/tomoyo/domain.c index 355b536262b1..43977083254b 100644 --- a/security/tomoyo/domain.c +++ b/security/tomoyo/domain.c | |||
@@ -59,6 +59,20 @@ int tomoyo_update_policy(struct tomoyo_acl_head *new_entry, const int size, | |||
59 | } | 59 | } |
60 | 60 | ||
61 | /** | 61 | /** |
62 | * tomoyo_same_acl_head - Check for duplicated "struct tomoyo_acl_info" entry. | ||
63 | * | ||
64 | * @a: Pointer to "struct tomoyo_acl_info". | ||
65 | * @b: Pointer to "struct tomoyo_acl_info". | ||
66 | * | ||
67 | * Returns true if @a == @b, false otherwise. | ||
68 | */ | ||
69 | static inline bool tomoyo_same_acl_head(const struct tomoyo_acl_info *a, | ||
70 | const struct tomoyo_acl_info *b) | ||
71 | { | ||
72 | return a->type == b->type; | ||
73 | } | ||
74 | |||
75 | /** | ||
62 | * tomoyo_update_domain - Update an entry for domain policy. | 76 | * tomoyo_update_domain - Update an entry for domain policy. |
63 | * | 77 | * |
64 | * @new_entry: Pointer to "struct tomoyo_acl_info". | 78 | * @new_entry: Pointer to "struct tomoyo_acl_info". |
@@ -88,7 +102,8 @@ int tomoyo_update_domain(struct tomoyo_acl_info *new_entry, const int size, | |||
88 | if (mutex_lock_interruptible(&tomoyo_policy_lock)) | 102 | if (mutex_lock_interruptible(&tomoyo_policy_lock)) |
89 | return error; | 103 | return error; |
90 | list_for_each_entry_rcu(entry, &domain->acl_info_list, list) { | 104 | list_for_each_entry_rcu(entry, &domain->acl_info_list, list) { |
91 | if (!check_duplicate(entry, new_entry)) | 105 | if (!tomoyo_same_acl_head(entry, new_entry) || |
106 | !check_duplicate(entry, new_entry)) | ||
92 | continue; | 107 | continue; |
93 | if (merge_duplicate) | 108 | if (merge_duplicate) |
94 | entry->is_deleted = merge_duplicate(entry, new_entry, | 109 | entry->is_deleted = merge_duplicate(entry, new_entry, |