Commit 82e0f001 authored by Tetsuo Handa's avatar Tetsuo Handa Committed by James Morris

TOMOYO: Use common structure for list element.

Use common "struct list_head" + "bool" structure.
Signed-off-by: default avatarTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: default avatarJames Morris <jmorris@namei.org>
parent 237ab459
...@@ -499,10 +499,10 @@ static int tomoyo_update_manager_entry(const char *manager, ...@@ -499,10 +499,10 @@ static int tomoyo_update_manager_entry(const char *manager,
return -ENOMEM; return -ENOMEM;
if (mutex_lock_interruptible(&tomoyo_policy_lock)) if (mutex_lock_interruptible(&tomoyo_policy_lock))
goto out; goto out;
list_for_each_entry_rcu(ptr, &tomoyo_policy_manager_list, list) { list_for_each_entry_rcu(ptr, &tomoyo_policy_manager_list, head.list) {
if (ptr->manager != e.manager) if (ptr->manager != e.manager)
continue; continue;
ptr->is_deleted = is_delete; ptr->head.is_deleted = is_delete;
error = 0; error = 0;
break; break;
} }
...@@ -510,7 +510,7 @@ static int tomoyo_update_manager_entry(const char *manager, ...@@ -510,7 +510,7 @@ static int tomoyo_update_manager_entry(const char *manager,
struct tomoyo_policy_manager_entry *entry = struct tomoyo_policy_manager_entry *entry =
tomoyo_commit_ok(&e, sizeof(e)); tomoyo_commit_ok(&e, sizeof(e));
if (entry) { if (entry) {
list_add_tail_rcu(&entry->list, list_add_tail_rcu(&entry->head.list,
&tomoyo_policy_manager_list); &tomoyo_policy_manager_list);
error = 0; error = 0;
} }
...@@ -562,8 +562,8 @@ static int tomoyo_read_manager_policy(struct tomoyo_io_buffer *head) ...@@ -562,8 +562,8 @@ static int tomoyo_read_manager_policy(struct tomoyo_io_buffer *head)
&tomoyo_policy_manager_list) { &tomoyo_policy_manager_list) {
struct tomoyo_policy_manager_entry *ptr; struct tomoyo_policy_manager_entry *ptr;
ptr = list_entry(pos, struct tomoyo_policy_manager_entry, ptr = list_entry(pos, struct tomoyo_policy_manager_entry,
list); head.list);
if (ptr->is_deleted) if (ptr->head.is_deleted)
continue; continue;
done = tomoyo_io_printf(head, "%s\n", ptr->manager->name); done = tomoyo_io_printf(head, "%s\n", ptr->manager->name);
if (!done) if (!done)
...@@ -593,8 +593,8 @@ static bool tomoyo_is_policy_manager(void) ...@@ -593,8 +593,8 @@ static bool tomoyo_is_policy_manager(void)
return true; return true;
if (!tomoyo_manage_by_non_root && (task->cred->uid || task->cred->euid)) if (!tomoyo_manage_by_non_root && (task->cred->uid || task->cred->euid))
return false; return false;
list_for_each_entry_rcu(ptr, &tomoyo_policy_manager_list, list) { list_for_each_entry_rcu(ptr, &tomoyo_policy_manager_list, head.list) {
if (!ptr->is_deleted && ptr->is_domain if (!ptr->head.is_deleted && ptr->is_domain
&& !tomoyo_pathcmp(domainname, ptr->manager)) { && !tomoyo_pathcmp(domainname, ptr->manager)) {
found = true; found = true;
break; break;
...@@ -605,8 +605,8 @@ static bool tomoyo_is_policy_manager(void) ...@@ -605,8 +605,8 @@ static bool tomoyo_is_policy_manager(void)
exe = tomoyo_get_exe(); exe = tomoyo_get_exe();
if (!exe) if (!exe)
return false; return false;
list_for_each_entry_rcu(ptr, &tomoyo_policy_manager_list, list) { list_for_each_entry_rcu(ptr, &tomoyo_policy_manager_list, head.list) {
if (!ptr->is_deleted && !ptr->is_domain if (!ptr->head.is_deleted && !ptr->is_domain
&& !strcmp(exe, ptr->manager->name)) { && !strcmp(exe, ptr->manager->name)) {
found = true; found = true;
break; break;
......
...@@ -188,6 +188,20 @@ enum tomoyo_mac_category_index { ...@@ -188,6 +188,20 @@ enum tomoyo_mac_category_index {
/********** Structure definitions. **********/ /********** Structure definitions. **********/
/*
* tomoyo_acl_head is a structure which is used for holding elements not in
* domain policy.
* It has following fields.
*
* (1) "list" which is linked to tomoyo_policy_list[] .
* (2) "is_deleted" is a bool which is true if marked as deleted, false
* otherwise.
*/
struct tomoyo_acl_head {
struct list_head list;
bool is_deleted;
} __packed;
/* /*
* tomoyo_request_info is a structure which is used for holding * tomoyo_request_info is a structure which is used for holding
* *
...@@ -274,15 +288,13 @@ struct tomoyo_number_group { ...@@ -274,15 +288,13 @@ struct tomoyo_number_group {
/* Structure for "path_group" directive. */ /* Structure for "path_group" directive. */
struct tomoyo_path_group_member { struct tomoyo_path_group_member {
struct list_head list; struct tomoyo_acl_head head;
bool is_deleted;
const struct tomoyo_path_info *member_name; const struct tomoyo_path_info *member_name;
}; };
/* Structure for "number_group" directive. */ /* Structure for "number_group" directive. */
struct tomoyo_number_group_member { struct tomoyo_number_group_member {
struct list_head list; struct tomoyo_acl_head head;
bool is_deleted;
struct tomoyo_number_union number; struct tomoyo_number_union number;
}; };
...@@ -523,15 +535,12 @@ struct tomoyo_io_buffer { ...@@ -523,15 +535,12 @@ struct tomoyo_io_buffer {
* "allow_read" entries. * "allow_read" entries.
* It has following fields. * It has following fields.
* *
* (1) "list" which is linked to tomoyo_globally_readable_list . * (1) "head" is "struct tomoyo_acl_head".
* (2) "filename" is a pathname which is allowed to open(O_RDONLY). * (2) "filename" is a pathname which is allowed to open(O_RDONLY).
* (3) "is_deleted" is a bool which is true if marked as deleted, false
* otherwise.
*/ */
struct tomoyo_globally_readable_file_entry { struct tomoyo_globally_readable_file_entry {
struct list_head list; struct tomoyo_acl_head head;
const struct tomoyo_path_info *filename; const struct tomoyo_path_info *filename;
bool is_deleted;
}; };
/* /*
...@@ -539,16 +548,13 @@ struct tomoyo_globally_readable_file_entry { ...@@ -539,16 +548,13 @@ struct tomoyo_globally_readable_file_entry {
* "tomoyo_pattern_list" entries. * "tomoyo_pattern_list" entries.
* It has following fields. * It has following fields.
* *
* (1) "list" which is linked to tomoyo_pattern_list . * (1) "head" is "struct tomoyo_acl_head".
* (2) "pattern" is a pathname pattern which is used for converting pathnames * (2) "pattern" is a pathname pattern which is used for converting pathnames
* to pathname patterns during learning mode. * to pathname patterns during learning mode.
* (3) "is_deleted" is a bool which is true if marked as deleted, false
* otherwise.
*/ */
struct tomoyo_pattern_entry { struct tomoyo_pattern_entry {
struct list_head list; struct tomoyo_acl_head head;
const struct tomoyo_path_info *pattern; const struct tomoyo_path_info *pattern;
bool is_deleted;
}; };
/* /*
...@@ -556,16 +562,13 @@ struct tomoyo_pattern_entry { ...@@ -556,16 +562,13 @@ struct tomoyo_pattern_entry {
* "deny_rewrite" entries. * "deny_rewrite" entries.
* It has following fields. * It has following fields.
* *
* (1) "list" which is linked to tomoyo_no_rewrite_list . * (1) "head" is "struct tomoyo_acl_head".
* (2) "pattern" is a pathname which is by default not permitted to modify * (2) "pattern" is a pathname which is by default not permitted to modify
* already existing content. * already existing content.
* (3) "is_deleted" is a bool which is true if marked as deleted, false
* otherwise.
*/ */
struct tomoyo_no_rewrite_entry { struct tomoyo_no_rewrite_entry {
struct list_head list; struct tomoyo_acl_head head;
const struct tomoyo_path_info *pattern; const struct tomoyo_path_info *pattern;
bool is_deleted;
}; };
/* /*
...@@ -573,25 +576,22 @@ struct tomoyo_no_rewrite_entry { ...@@ -573,25 +576,22 @@ struct tomoyo_no_rewrite_entry {
* "initialize_domain" and "no_initialize_domain" entries. * "initialize_domain" and "no_initialize_domain" entries.
* It has following fields. * It has following fields.
* *
* (1) "list" which is linked to tomoyo_domain_initializer_list . * (1) "head" is "struct tomoyo_acl_head".
* (2) "domainname" which is "a domainname" or "the last component of a * (2) "is_not" is a bool which is true if "no_initialize_domain", false
* domainname". This field is NULL if "from" clause is not specified.
* (3) "program" which is a program's pathname.
* (4) "is_deleted" is a bool which is true if marked as deleted, false
* otherwise. * otherwise.
* (5) "is_not" is a bool which is true if "no_initialize_domain", false * (3) "is_last_name" is a bool which is true if "domainname" is "the last
* otherwise.
* (6) "is_last_name" is a bool which is true if "domainname" is "the last
* component of a domainname", false otherwise. * component of a domainname", false otherwise.
* (4) "domainname" which is "a domainname" or "the last component of a
* domainname". This field is NULL if "from" clause is not specified.
* (5) "program" which is a program's pathname.
*/ */
struct tomoyo_domain_initializer_entry { struct tomoyo_domain_initializer_entry {
struct list_head list; struct tomoyo_acl_head head;
const struct tomoyo_path_info *domainname; /* This may be NULL */
const struct tomoyo_path_info *program;
bool is_deleted;
bool is_not; /* True if this entry is "no_initialize_domain". */ bool is_not; /* True if this entry is "no_initialize_domain". */
/* True if the domainname is tomoyo_get_last_name(). */ /* True if the domainname is tomoyo_get_last_name(). */
bool is_last_name; bool is_last_name;
const struct tomoyo_path_info *domainname; /* This may be NULL */
const struct tomoyo_path_info *program;
}; };
/* /*
...@@ -599,26 +599,23 @@ struct tomoyo_domain_initializer_entry { ...@@ -599,26 +599,23 @@ struct tomoyo_domain_initializer_entry {
* "keep_domain" and "no_keep_domain" entries. * "keep_domain" and "no_keep_domain" entries.
* It has following fields. * It has following fields.
* *
* (1) "list" which is linked to tomoyo_domain_keeper_list . * (1) "head" is "struct tomoyo_acl_head".
* (2) "domainname" which is "a domainname" or "the last component of a * (2) "is_not" is a bool which is true if "no_initialize_domain", false
* domainname".
* (3) "program" which is a program's pathname.
* This field is NULL if "from" clause is not specified.
* (4) "is_deleted" is a bool which is true if marked as deleted, false
* otherwise. * otherwise.
* (5) "is_not" is a bool which is true if "no_initialize_domain", false * (3) "is_last_name" is a bool which is true if "domainname" is "the last
* otherwise.
* (6) "is_last_name" is a bool which is true if "domainname" is "the last
* component of a domainname", false otherwise. * component of a domainname", false otherwise.
* (4) "domainname" which is "a domainname" or "the last component of a
* domainname".
* (5) "program" which is a program's pathname.
* This field is NULL if "from" clause is not specified.
*/ */
struct tomoyo_domain_keeper_entry { struct tomoyo_domain_keeper_entry {
struct list_head list; struct tomoyo_acl_head head;
const struct tomoyo_path_info *domainname;
const struct tomoyo_path_info *program; /* This may be NULL */
bool is_deleted;
bool is_not; /* True if this entry is "no_keep_domain". */ bool is_not; /* True if this entry is "no_keep_domain". */
/* True if the domainname is tomoyo_get_last_name(). */ /* True if the domainname is tomoyo_get_last_name(). */
bool is_last_name; bool is_last_name;
const struct tomoyo_path_info *domainname;
const struct tomoyo_path_info *program; /* This may be NULL */
}; };
/* /*
...@@ -626,34 +623,28 @@ struct tomoyo_domain_keeper_entry { ...@@ -626,34 +623,28 @@ struct tomoyo_domain_keeper_entry {
* "aggregator" entries. * "aggregator" entries.
* It has following fields. * It has following fields.
* *
* (1) "list" which is linked to tomoyo_aggregator_list . * (1) "head" is "struct tomoyo_acl_head".
* (2) "original_name" which is originally requested name. * (2) "original_name" which is originally requested name.
* (3) "aggregated_name" which is name to rewrite. * (3) "aggregated_name" which is name to rewrite.
* (4) "is_deleted" is a bool which is true if marked as deleted, false
* otherwise.
*/ */
struct tomoyo_aggregator_entry { struct tomoyo_aggregator_entry {
struct list_head list; struct tomoyo_acl_head head;
const struct tomoyo_path_info *original_name; const struct tomoyo_path_info *original_name;
const struct tomoyo_path_info *aggregated_name; const struct tomoyo_path_info *aggregated_name;
bool is_deleted;
}; };
/* /*
* tomoyo_alias_entry is a structure which is used for holding "alias" entries. * tomoyo_alias_entry is a structure which is used for holding "alias" entries.
* It has following fields. * It has following fields.
* *
* (1) "list" which is linked to tomoyo_alias_list . * (1) "head" is "struct tomoyo_acl_head".
* (2) "original_name" which is a dereferenced pathname. * (2) "original_name" which is a dereferenced pathname.
* (3) "aliased_name" which is a symlink's pathname. * (3) "aliased_name" which is a symlink's pathname.
* (4) "is_deleted" is a bool which is true if marked as deleted, false
* otherwise.
*/ */
struct tomoyo_alias_entry { struct tomoyo_alias_entry {
struct list_head list; struct tomoyo_acl_head head;
const struct tomoyo_path_info *original_name; const struct tomoyo_path_info *original_name;
const struct tomoyo_path_info *aliased_name; const struct tomoyo_path_info *aliased_name;
bool is_deleted;
}; };
/* /*
...@@ -662,19 +653,16 @@ struct tomoyo_alias_entry { ...@@ -662,19 +653,16 @@ struct tomoyo_alias_entry {
* /sys/kernel/security/tomoyo/ interface. * /sys/kernel/security/tomoyo/ interface.
* It has following fields. * It has following fields.
* *
* (1) "list" which is linked to tomoyo_policy_manager_list . * (1) "head" is "struct tomoyo_acl_head".
* (2) "manager" is a domainname or a program's pathname. * (2) "is_domain" is a bool which is true if "manager" is a domainname, false
* (3) "is_domain" is a bool which is true if "manager" is a domainname, false
* otherwise.
* (4) "is_deleted" is a bool which is true if marked as deleted, false
* otherwise. * otherwise.
* (3) "manager" is a domainname or a program's pathname.
*/ */
struct tomoyo_policy_manager_entry { struct tomoyo_policy_manager_entry {
struct list_head list; struct tomoyo_acl_head head;
bool is_domain; /* True if manager is a domainname. */
/* A path to program or a domainname. */ /* A path to program or a domainname. */
const struct tomoyo_path_info *manager; const struct tomoyo_path_info *manager;
bool is_domain; /* True if manager is a domainname. */
bool is_deleted; /* True if this entry is deleted. */
}; };
struct tomoyo_preference { struct tomoyo_preference {
......
...@@ -199,10 +199,11 @@ static int tomoyo_update_domain_initializer_entry(const char *domainname, ...@@ -199,10 +199,11 @@ static int tomoyo_update_domain_initializer_entry(const char *domainname,
goto out; goto out;
if (mutex_lock_interruptible(&tomoyo_policy_lock)) if (mutex_lock_interruptible(&tomoyo_policy_lock))
goto out; goto out;
list_for_each_entry_rcu(ptr, &tomoyo_domain_initializer_list, list) { list_for_each_entry_rcu(ptr, &tomoyo_domain_initializer_list,
head.list) {
if (!tomoyo_is_same_domain_initializer_entry(ptr, &e)) if (!tomoyo_is_same_domain_initializer_entry(ptr, &e))
continue; continue;
ptr->is_deleted = is_delete; ptr->head.is_deleted = is_delete;
error = 0; error = 0;
break; break;
} }
...@@ -210,7 +211,7 @@ static int tomoyo_update_domain_initializer_entry(const char *domainname, ...@@ -210,7 +211,7 @@ static int tomoyo_update_domain_initializer_entry(const char *domainname,
struct tomoyo_domain_initializer_entry *entry = struct tomoyo_domain_initializer_entry *entry =
tomoyo_commit_ok(&e, sizeof(e)); tomoyo_commit_ok(&e, sizeof(e));
if (entry) { if (entry) {
list_add_tail_rcu(&entry->list, list_add_tail_rcu(&entry->head.list,
&tomoyo_domain_initializer_list); &tomoyo_domain_initializer_list);
error = 0; error = 0;
} }
...@@ -243,8 +244,8 @@ bool tomoyo_read_domain_initializer_policy(struct tomoyo_io_buffer *head) ...@@ -243,8 +244,8 @@ bool tomoyo_read_domain_initializer_policy(struct tomoyo_io_buffer *head)
const char *domain = ""; const char *domain = "";
struct tomoyo_domain_initializer_entry *ptr; struct tomoyo_domain_initializer_entry *ptr;
ptr = list_entry(pos, struct tomoyo_domain_initializer_entry, ptr = list_entry(pos, struct tomoyo_domain_initializer_entry,
list); head.list);
if (ptr->is_deleted) if (ptr->head.is_deleted)
continue; continue;
no = ptr->is_not ? "no_" : ""; no = ptr->is_not ? "no_" : "";
if (ptr->domainname) { if (ptr->domainname) {
...@@ -308,8 +309,9 @@ static bool tomoyo_is_domain_initializer(const struct tomoyo_path_info * ...@@ -308,8 +309,9 @@ static bool tomoyo_is_domain_initializer(const struct tomoyo_path_info *
struct tomoyo_domain_initializer_entry *ptr; struct tomoyo_domain_initializer_entry *ptr;
bool flag = false; bool flag = false;
list_for_each_entry_rcu(ptr, &tomoyo_domain_initializer_list, list) { list_for_each_entry_rcu(ptr, &tomoyo_domain_initializer_list,
if (ptr->is_deleted) head.list) {
if (ptr->head.is_deleted)
continue; continue;
if (ptr->domainname) { if (ptr->domainname) {
if (!ptr->is_last_name) { if (!ptr->is_last_name) {
...@@ -409,10 +411,10 @@ static int tomoyo_update_domain_keeper_entry(const char *domainname, ...@@ -409,10 +411,10 @@ static int tomoyo_update_domain_keeper_entry(const char *domainname,
goto out; goto out;
if (mutex_lock_interruptible(&tomoyo_policy_lock)) if (mutex_lock_interruptible(&tomoyo_policy_lock))
goto out; goto out;
list_for_each_entry_rcu(ptr, &tomoyo_domain_keeper_list, list) { list_for_each_entry_rcu(ptr, &tomoyo_domain_keeper_list, head.list) {
if (!tomoyo_is_same_domain_keeper_entry(ptr, &e)) if (!tomoyo_is_same_domain_keeper_entry(ptr, &e))
continue; continue;
ptr->is_deleted = is_delete; ptr->head.is_deleted = is_delete;
error = 0; error = 0;
break; break;
} }
...@@ -420,7 +422,7 @@ static int tomoyo_update_domain_keeper_entry(const char *domainname, ...@@ -420,7 +422,7 @@ static int tomoyo_update_domain_keeper_entry(const char *domainname,
struct tomoyo_domain_keeper_entry *entry = struct tomoyo_domain_keeper_entry *entry =
tomoyo_commit_ok(&e, sizeof(e)); tomoyo_commit_ok(&e, sizeof(e));
if (entry) { if (entry) {
list_add_tail_rcu(&entry->list, list_add_tail_rcu(&entry->head.list,
&tomoyo_domain_keeper_list); &tomoyo_domain_keeper_list);
error = 0; error = 0;
} }
...@@ -475,8 +477,9 @@ bool tomoyo_read_domain_keeper_policy(struct tomoyo_io_buffer *head) ...@@ -475,8 +477,9 @@ bool tomoyo_read_domain_keeper_policy(struct tomoyo_io_buffer *head)
const char *from = ""; const char *from = "";
const char *program = ""; const char *program = "";
ptr = list_entry(pos, struct tomoyo_domain_keeper_entry, list); ptr = list_entry(pos, struct tomoyo_domain_keeper_entry,
if (ptr->is_deleted) head.list);
if (ptr->head.is_deleted)
continue; continue;
no = ptr->is_not ? "no_" : ""; no = ptr->is_not ? "no_" : "";
if (ptr->program) { if (ptr->program) {
...@@ -512,8 +515,8 @@ static bool tomoyo_is_domain_keeper(const struct tomoyo_path_info *domainname, ...@@ -512,8 +515,8 @@ static bool tomoyo_is_domain_keeper(const struct tomoyo_path_info *domainname,
struct tomoyo_domain_keeper_entry *ptr; struct tomoyo_domain_keeper_entry *ptr;
bool flag = false; bool flag = false;
list_for_each_entry_rcu(ptr, &tomoyo_domain_keeper_list, list) { list_for_each_entry_rcu(ptr, &tomoyo_domain_keeper_list, head.list) {
if (ptr->is_deleted) if (ptr->head.is_deleted)
continue; continue;
if (!ptr->is_last_name) { if (!ptr->is_last_name) {
if (ptr->domainname != domainname) if (ptr->domainname != domainname)
...@@ -591,10 +594,10 @@ static int tomoyo_update_aggregator_entry(const char *original_name, ...@@ -591,10 +594,10 @@ static int tomoyo_update_aggregator_entry(const char *original_name,
goto out; goto out;
if (mutex_lock_interruptible(&tomoyo_policy_lock)) if (mutex_lock_interruptible(&tomoyo_policy_lock))
goto out; goto out;
list_for_each_entry_rcu(ptr, &tomoyo_aggregator_list, list) { list_for_each_entry_rcu(ptr, &tomoyo_aggregator_list, head.list) {
if (!tomoyo_is_same_aggregator_entry(ptr, &e)) if (!tomoyo_is_same_aggregator_entry(ptr, &e))
continue; continue;
ptr->is_deleted = is_delete; ptr->head.is_deleted = is_delete;
error = 0; error = 0;
break; break;
} }
...@@ -602,7 +605,7 @@ static int tomoyo_update_aggregator_entry(const char *original_name, ...@@ -602,7 +605,7 @@ static int tomoyo_update_aggregator_entry(const char *original_name,
struct tomoyo_aggregator_entry *entry = struct tomoyo_aggregator_entry *entry =
tomoyo_commit_ok(&e, sizeof(e)); tomoyo_commit_ok(&e, sizeof(e));
if (entry) { if (entry) {
list_add_tail_rcu(&entry->list, list_add_tail_rcu(&entry->head.list,
&tomoyo_aggregator_list); &tomoyo_aggregator_list);
error = 0; error = 0;
} }
...@@ -631,8 +634,9 @@ bool tomoyo_read_aggregator_policy(struct tomoyo_io_buffer *head) ...@@ -631,8 +634,9 @@ bool tomoyo_read_aggregator_policy(struct tomoyo_io_buffer *head)
list_for_each_cookie(pos, head->read_var2, &tomoyo_aggregator_list) { list_for_each_cookie(pos, head->read_var2, &tomoyo_aggregator_list) {
struct tomoyo_aggregator_entry *ptr; struct tomoyo_aggregator_entry *ptr;
ptr = list_entry(pos, struct tomoyo_aggregator_entry, list); ptr = list_entry(pos, struct tomoyo_aggregator_entry,
if (ptr->is_deleted) head.list);
if (ptr->head.is_deleted)
continue; continue;
done = tomoyo_io_printf(head, TOMOYO_KEYWORD_AGGREGATOR done = tomoyo_io_printf(head, TOMOYO_KEYWORD_AGGREGATOR
"%s %s\n", ptr->original_name->name, "%s %s\n", ptr->original_name->name,
...@@ -724,10 +728,10 @@ static int tomoyo_update_alias_entry(const char *original_name, ...@@ -724,10 +728,10 @@ static int tomoyo_update_alias_entry(const char *original_name,
goto out; /* No patterns allowed. */ goto out; /* No patterns allowed. */
if (mutex_lock_interruptible(&tomoyo_policy_lock)) if (mutex_lock_interruptible(&tomoyo_policy_lock))
goto out; goto out;
list_for_each_entry_rcu(ptr, &tomoyo_alias_list, list) { list_for_each_entry_rcu(ptr, &tomoyo_alias_list, head.list) {
if (!tomoyo_is_same_alias_entry(ptr, &e)) if (!tomoyo_is_same_alias_entry(ptr, &e))
continue; continue;
ptr->is_deleted = is_delete; ptr->head.is_deleted = is_delete;
error = 0; error = 0;
break; break;
} }
...@@ -735,7 +739,8 @@ static int tomoyo_update_alias_entry(const char *original_name, ...@@ -735,7 +739,8 @@ static int tomoyo_update_alias_entry(const char *original_name,
struct tomoyo_alias_entry *entry = struct tomoyo_alias_entry *entry =
tomoyo_commit_ok(&e, sizeof(e)); tomoyo_commit_ok(&e, sizeof(e));
if (entry) { if (entry) {
list_add_tail_rcu(&entry->list, &tomoyo_alias_list); list_add_tail_rcu(&entry->head.list,
&tomoyo_alias_list);
error = 0; error = 0;
} }
} }
...@@ -763,8 +768,8 @@ bool tomoyo_read_alias_policy(struct tomoyo_io_buffer *head) ...@@ -763,8 +768,8 @@ bool tomoyo_read_alias_policy(struct tomoyo_io_buffer *head)
list_for_each_cookie(pos, head->read_var2, &tomoyo_alias_list) { list_for_each_cookie(pos, head->read_var2, &tomoyo_alias_list) {
struct tomoyo_alias_entry *ptr; struct tomoyo_alias_entry *ptr;
ptr = list_entry(pos, struct tomoyo_alias_entry, list); ptr = list_entry(pos, struct tomoyo_alias_entry, head.list);
if (ptr->is_deleted) if (ptr->head.is_deleted)
continue; continue;
done = tomoyo_io_printf(head, TOMOYO_KEYWORD_ALIAS "%s %s\n", done = tomoyo_io_printf(head, TOMOYO_KEYWORD_ALIAS "%s %s\n",
ptr->original_name->name, ptr->original_name->name,
...@@ -901,8 +906,8 @@ int tomoyo_find_next_domain(struct linux_binprm *bprm) ...@@ -901,8 +906,8 @@ int tomoyo_find_next_domain(struct linux_binprm *bprm)
if (tomoyo_pathcmp(&rn, &sn)) { if (tomoyo_pathcmp(&rn, &sn)) {
struct tomoyo_alias_entry *ptr; struct tomoyo_alias_entry *ptr;
/* Is this program allowed to be called via symbolic links? */ /* Is this program allowed to be called via symbolic links? */
list_for_each_entry_rcu(ptr, &tomoyo_alias_list, list) { list_for_each_entry_rcu(ptr, &tomoyo_alias_list, head.list) {
if (ptr->is_deleted || if (ptr->head.is_deleted ||
tomoyo_pathcmp(&rn, ptr->original_name) || tomoyo_pathcmp(&rn, ptr->original_name) ||
tomoyo_pathcmp(&sn, ptr->aliased_name)) tomoyo_pathcmp(&sn, ptr->aliased_name))
continue; continue;
...@@ -917,8 +922,9 @@ int tomoyo_find_next_domain(struct linux_binprm *bprm) ...@@ -917,8 +922,9 @@ int tomoyo_find_next_domain(struct linux_binprm *bprm)
/* Check 'aggregator' directive. */ /* Check 'aggregator' directive. */
{ {
struct tomoyo_aggregator_entry *ptr; struct tomoyo_aggregator_entry *ptr;
list_for_each_entry_rcu(ptr, &tomoyo_aggregator_list, list) { list_for_each_entry_rcu(ptr, &tomoyo_aggregator_list,
if (ptr->is_deleted || head.list) {
if (ptr->head.is_deleted ||
!tomoyo_path_matches_pattern(&rn, !tomoyo_path_matches_pattern(&rn,
ptr->original_name)) ptr->original_name))
continue; continue;
......
...@@ -277,10 +277,11 @@ static int tomoyo_update_globally_readable_entry(const char *filename, ...@@ -277,10 +277,11 @@ static int tomoyo_update_globally_readable_entry(const char *filename,
return -ENOMEM; return -ENOMEM;
if (mutex_lock_interruptible(&tomoyo_policy_lock)) if (mutex_lock_interruptible(&tomoyo_policy_lock))
goto out; goto out;
list_for_each_entry_rcu(ptr, &tomoyo_globally_readable_list, list) { list_for_each_entry_rcu(ptr, &tomoyo_globally_readable_list,
head.list) {
if (ptr->filename != e.filename) if (ptr->filename != e.filename)
continue; continue;
ptr->is_deleted = is_delete; ptr->head.is_deleted = is_delete;
error = 0; error = 0;
break; break;
} }
...@@ -288,7 +289,7 @@ static int tomoyo_update_globally_readable_entry(const char *filename, ...@@ -288,7 +289,7 @@ static int tomoyo_update_globally_readable_entry(const char *filename,
struct tomoyo_globally_readable_file_entry *entry = struct tomoyo_globally_readable_file_entry *entry =
tomoyo_commit_ok(&e, sizeof(e)); tomoyo_commit_ok(&e, sizeof(e));
if (entry) { if (entry) {
list_add_tail_rcu(&entry->list, list_add_tail_rcu(&entry->head.list,
&tomoyo_globally_readable_list); &tomoyo_globally_readable_list);
error = 0; error = 0;
} }
...@@ -314,8 +315,9 @@ static bool tomoyo_is_globally_readable_file(const struct tomoyo_path_info * ...@@ -314,8 +315,9 @@ static bool tomoyo_is_globally_readable_file(const struct tomoyo_path_info *
struct tomoyo_globally_readable_file_entry *ptr; struct tomoyo_globally_readable_file_entry *ptr;
bool found = false; bool found = false;
list_for_each_entry_rcu(ptr, &tomoyo_globally_readable_list, list) { list_for_each_entry_rcu(ptr, &tomoyo_globally_readable_list,
if (!ptr->is_deleted && head.list) {
if (!ptr->head.is_deleted &&
tomoyo_path_matches_pattern(filename, ptr->filename)) { tomoyo_path_matches_pattern(filename, ptr->filename)) {
found = true; found = true;
break; break;
...@@ -358,8 +360,8 @@ bool tomoyo_read_globally_readable_policy(struct tomoyo_io_buffer *head) ...@@ -358,8 +360,8 @@ bool tomoyo_read_globally_readable_policy(struct tomoyo_io_buffer *head)
struct tomoyo_globally_readable_file_entry *ptr; struct tomoyo_globally_readable_file_entry *ptr;
ptr = list_entry(pos, ptr = list_entry(pos,
struct tomoyo_globally_readable_file_entry, struct tomoyo_globally_readable_file_entry,
list); head.list);
if (ptr->is_deleted) if (ptr->head.is_deleted)
continue; continue;
done = tomoyo_io_printf(head, TOMOYO_KEYWORD_ALLOW_READ "%s\n", done = tomoyo_io_printf(head, TOMOYO_KEYWORD_ALLOW_READ "%s\n",
ptr->filename->name); ptr->filename->name);
...@@ -424,10 +426,10 @@ static int tomoyo_update_file_pattern_entry(const char *pattern, ...@@ -424,10 +426,10 @@ static int tomoyo_update_file_pattern_entry(const char *pattern,
return error; return error;
if (mutex_lock_interruptible(&tomoyo_policy_lock)) if (mutex_lock_interruptible(&tomoyo_policy_lock))
goto out; goto out;
list_for_each_entry_rcu(ptr, &tomoyo_pattern_list, list) { list_for_each_entry_rcu(ptr, &tomoyo_pattern_list, head.list) {
if (e.pattern != ptr->pattern) if (e.pattern != ptr->pattern)
continue; continue;
ptr->is_deleted = is_delete; ptr->head.is_deleted = is_delete;
error = 0; error = 0;
break; break;
} }
...@@ -435,7 +437,8 @@ static int tomoyo_update_file_pattern_entry(const char *pattern, ...@@ -435,7 +437,8 @@ static int tomoyo_update_file_pattern_entry(const char *pattern,
struct tomoyo_pattern_entry *entry = struct tomoyo_pattern_entry *entry =
tomoyo_commit_ok(&e, sizeof(e)); tomoyo_commit_ok(&e, sizeof(e));
if (entry) { if (entry) {
list_add_tail_rcu(&entry->list, &tomoyo_pattern_list); list_add_tail_rcu(&entry->head.list,
&tomoyo_pattern_list);
error = 0; error = 0;
} }
} }
...@@ -459,8 +462,8 @@ const char *tomoyo_file_pattern(const struct tomoyo_path_info *filename) ...@@ -459,8 +462,8 @@ const char *tomoyo_file_pattern(const struct tomoyo_path_info *filename)
struct tomoyo_pattern_entry *ptr; struct tomoyo_pattern_entry *ptr;
const struct tomoyo_path_info *pattern = NULL; const struct tomoyo_path_info *pattern = NULL;
list_for_each_entry_rcu(ptr, &tomoyo_pattern_list, list) { list_for_each_entry_rcu(ptr, &tomoyo_pattern_list, head.list) {
if (ptr->is_deleted) if (ptr->head.is_deleted)
continue; continue;
if (!tomoyo_path_matches_pattern(filename, ptr->pattern)) if (!tomoyo_path_matches_pattern(filename, ptr->pattern))
continue; continue;
...@@ -508,8 +511,8 @@ bool tomoyo_read_file_pattern(struct tomoyo_io_buffer *head) ...@@ -508,8 +511,8 @@ bool tomoyo_read_file_pattern(struct tomoyo_io_buffer *head)
list_for_each_cookie(pos, head->read_var2, &tomoyo_pattern_list) { list_for_each_cookie(pos, head->read_var2, &tomoyo_pattern_list) {
struct tomoyo_pattern_entry *ptr; struct tomoyo_pattern_entry *ptr;
ptr = list_entry(pos, struct tomoyo_pattern_entry, list); ptr = list_entry(pos, struct tomoyo_pattern_entry, head.list);
if (ptr->is_deleted) if (ptr->head.is_deleted)
continue; continue;
done = tomoyo_io_printf(head, TOMOYO_KEYWORD_FILE_PATTERN done = tomoyo_io_printf(head, TOMOYO_KEYWORD_FILE_PATTERN
"%s\n", ptr->pattern->name); "%s\n", ptr->pattern->name);
...@@ -574,10 +577,10 @@ static int tomoyo_update_no_rewrite_entry(const char *pattern, ...@@ -574,10 +577,10 @@ static int tomoyo_update_no_rewrite_entry(const char *pattern,
return error; return error;
if (mutex_lock_interruptible(&tomoyo_policy_lock)) if (mutex_lock_interruptible(&tomoyo_policy_lock))
goto out; goto out;
list_for_each_entry_rcu(ptr, &tomoyo_no_rewrite_list, list) { list_for_each_entry_rcu(ptr, &tomoyo_no_rewrite_list, head.list) {
if (ptr->pattern != e.pattern) if (ptr->pattern != e.pattern)
continue; continue;
ptr->is_deleted = is_delete; ptr->head.is_deleted = is_delete;
error = 0; error = 0;
break; break;
} }
...@@ -585,7 +588,7 @@ static int tomoyo_update_no_rewrite_entry(const char *pattern, ...@@ -585,7 +588,7 @@ static int tomoyo_update_no_rewrite_entry(const char *pattern,
struct tomoyo_no_rewrite_entry *entry = struct tomoyo_no_rewrite_entry *entry =
tomoyo_commit_ok(&e, sizeof(e)); tomoyo_commit_ok(&e, sizeof(e));
if (entry) { if (entry) {
list_add_tail_rcu(&entry->list, list_add_tail_rcu(&entry->head.list,
&tomoyo_no_rewrite_list); &tomoyo_no_rewrite_list);
error = 0; error = 0;
} }
...@@ -611,8 +614,8 @@ static bool tomoyo_is_no_rewrite_file(const struct tomoyo_path_info *filename) ...@@ -611,8 +614,8 @@ static bool tomoyo_is_no_rewrite_file(const struct tomoyo_path_info *filename)
struct tomoyo_no_rewrite_entry *ptr; struct tomoyo_no_rewrite_entry *ptr;
bool found = false; bool found = false;
list_for_each_entry_rcu(ptr, &tomoyo_no_rewrite_list, list) { list_for_each_entry_rcu(ptr, &tomoyo_no_rewrite_list, head.list) {
if (ptr->is_deleted) if (ptr->head.is_deleted)
continue; continue;
if (!tomoyo_path_matches_pattern(filename, ptr->pattern)) if (!tomoyo_path_matches_pattern(filename, ptr->pattern))
continue; continue;
...@@ -653,8 +656,9 @@ bool tomoyo_read_no_rewrite_policy(struct tomoyo_io_buffer *head) ...@@ -653,8 +656,9 @@ bool tomoyo_read_no_rewrite_policy(struct tomoyo_io_buffer *head)
list_for_each_cookie(pos, head->read_var2, &tomoyo_no_rewrite_list) { list_for_each_cookie(pos, head->read_var2, &tomoyo_no_rewrite_list) {
struct tomoyo_no_rewrite_entry *ptr; struct tomoyo_no_rewrite_entry *ptr;
ptr = list_entry(pos, struct tomoyo_no_rewrite_entry, list); ptr = list_entry(pos, struct tomoyo_no_rewrite_entry,
if (ptr->is_deleted) head.list);
if (ptr->head.is_deleted)
continue; continue;
done = tomoyo_io_printf(head, TOMOYO_KEYWORD_DENY_REWRITE done = tomoyo_io_printf(head, TOMOYO_KEYWORD_DENY_REWRITE
"%s\n", ptr->pattern->name); "%s\n", ptr->pattern->name);
......
...@@ -216,33 +216,34 @@ static void tomoyo_collect_entry(void) ...@@ -216,33 +216,34 @@ static void tomoyo_collect_entry(void)
{ {
struct tomoyo_globally_readable_file_entry *ptr; struct tomoyo_globally_readable_file_entry *ptr;
list_for_each_entry_rcu(ptr, &tomoyo_globally_readable_list, list_for_each_entry_rcu(ptr, &tomoyo_globally_readable_list,
list) { head.list) {
if (!ptr->is_deleted) if (!ptr->head.is_deleted)
continue; continue;
if (tomoyo_add_to_gc(TOMOYO_ID_GLOBALLY_READABLE, ptr)) if (tomoyo_add_to_gc(TOMOYO_ID_GLOBALLY_READABLE, ptr))
list_del_rcu(&ptr->list); list_del_rcu(&ptr->head.list);
else else
break; break;
} }
} }
{ {
struct tomoyo_pattern_entry *ptr; struct tomoyo_pattern_entry *ptr;
list_for_each_entry_rcu(ptr, &tomoyo_pattern_list, list) { list_for_each_entry_rcu(ptr, &tomoyo_pattern_list, head.list) {
if (!ptr->is_deleted) if (!ptr->head.is_deleted)
continue; continue;
if (tomoyo_add_to_gc(TOMOYO_ID_PATTERN, ptr)) if (tomoyo_add_to_gc(TOMOYO_ID_PATTERN, ptr))
list_del_rcu(&ptr->list); list_del_rcu(&ptr->head.list);
else else
break; break;
} }
} }
{ {
struct tomoyo_no_rewrite_entry *ptr; struct tomoyo_no_rewrite_entry *ptr;
list_for_each_entry_rcu(ptr, &tomoyo_no_rewrite_list, list) { list_for_each_entry_rcu(ptr, &tomoyo_no_rewrite_list,
if (!ptr->is_deleted) head.list) {
if (!ptr->head.is_deleted)
continue; continue;
if (tomoyo_add_to_gc(TOMOYO_ID_NO_REWRITE, ptr)) if (tomoyo_add_to_gc(TOMOYO_ID_NO_REWRITE, ptr))
list_del_rcu(&ptr->list); list_del_rcu(&ptr->head.list);
else else
break; break;
} }
...@@ -250,44 +251,46 @@ static void tomoyo_collect_entry(void) ...@@ -250,44 +251,46 @@ static void tomoyo_collect_entry(void)
{ {
struct tomoyo_domain_initializer_entry *ptr; struct tomoyo_domain_initializer_entry *ptr;
list_for_each_entry_rcu(ptr, &tomoyo_domain_initializer_list, list_for_each_entry_rcu(ptr, &tomoyo_domain_initializer_list,
list) { head.list) {
if (!ptr->is_deleted) if (!ptr->head.is_deleted)
continue; continue;
if (tomoyo_add_to_gc(TOMOYO_ID_DOMAIN_INITIALIZER, ptr)) if (tomoyo_add_to_gc(TOMOYO_ID_DOMAIN_INITIALIZER, ptr))
list_del_rcu(&ptr->list); list_del_rcu(&ptr->head.list);
else else
break; break;
} }
} }
{ {
struct tomoyo_domain_keeper_entry *ptr; struct tomoyo_domain_keeper_entry *ptr;
list_for_each_entry_rcu(ptr, &tomoyo_domain_keeper_list, list) { list_for_each_entry_rcu(ptr, &tomoyo_domain_keeper_list,
if (!ptr->is_deleted) head.list) {
if (!ptr->head.is_deleted)
continue; continue;
if (tomoyo_add_to_gc(TOMOYO_ID_DOMAIN_KEEPER, ptr)) if (tomoyo_add_to_gc(TOMOYO_ID_DOMAIN_KEEPER, ptr))
list_del_rcu(&ptr->list); list_del_rcu(&ptr->head.list);
else else
break; break;
} }
} }
{ {
struct tomoyo_aggregator_entry *ptr; struct tomoyo_aggregator_entry *ptr;
list_for_each_entry_rcu(ptr, &tomoyo_aggregator_list, list) { list_for_each_entry_rcu(ptr, &tomoyo_aggregator_list,
if (!ptr->is_deleted) head.list) {
if (!ptr->head.is_deleted)
continue; continue;
if (tomoyo_add_to_gc(TOMOYO_ID_AGGREGATOR, ptr)) if (tomoyo_add_to_gc(TOMOYO_ID_AGGREGATOR, ptr))
list_del_rcu(&ptr->list); list_del_rcu(&ptr->head.list);
else else
break; break;
} }
} }
{ {
struct tomoyo_alias_entry *ptr; struct tomoyo_alias_entry *ptr;
list_for_each_entry_rcu(ptr, &tomoyo_alias_list, list) { list_for_each_entry_rcu(ptr, &tomoyo_alias_list, head.list) {
if (!ptr->is_deleted) if (!ptr->head.is_deleted)
continue; continue;
if (tomoyo_add_to_gc(TOMOYO_ID_ALIAS, ptr)) if (tomoyo_add_to_gc(TOMOYO_ID_ALIAS, ptr))
list_del_rcu(&ptr->list); list_del_rcu(&ptr->head.list);
else else
break; break;
} }
...@@ -295,11 +298,11 @@ static void tomoyo_collect_entry(void) ...@@ -295,11 +298,11 @@ static void tomoyo_collect_entry(void)
{ {
struct tomoyo_policy_manager_entry *ptr; struct tomoyo_policy_manager_entry *ptr;
list_for_each_entry_rcu(ptr, &tomoyo_policy_manager_list, list_for_each_entry_rcu(ptr, &tomoyo_policy_manager_list,
list) { head.list) {
if (!ptr->is_deleted) if (!ptr->head.is_deleted)
continue; continue;
if (tomoyo_add_to_gc(TOMOYO_ID_MANAGER, ptr)) if (tomoyo_add_to_gc(TOMOYO_ID_MANAGER, ptr))
list_del_rcu(&ptr->list); list_del_rcu(&ptr->head.list);
else else
break; break;
} }
...@@ -352,12 +355,12 @@ static void tomoyo_collect_entry(void) ...@@ -352,12 +355,12 @@ static void tomoyo_collect_entry(void)
list_for_each_entry_rcu(group, &tomoyo_path_group_list, list) { list_for_each_entry_rcu(group, &tomoyo_path_group_list, list) {
struct tomoyo_path_group_member *member; struct tomoyo_path_group_member *member;
list_for_each_entry_rcu(member, &group->member_list, list_for_each_entry_rcu(member, &group->member_list,
list) { head.list) {
if (!member->is_deleted) if (!member->head.is_deleted)
continue; continue;
if (tomoyo_add_to_gc(TOMOYO_ID_PATH_GROUP_MEMBER, if (tomoyo_add_to_gc(TOMOYO_ID_PATH_GROUP_MEMBER,
member)) member))
list_del_rcu(&member->list); list_del_rcu(&member->head.list);
else else
break; break;
} }
...@@ -375,12 +378,12 @@ static void tomoyo_collect_entry(void) ...@@ -375,12 +378,12 @@ static void tomoyo_collect_entry(void)
list_for_each_entry_rcu(group, &tomoyo_number_group_list, list) { list_for_each_entry_rcu(group, &tomoyo_number_group_list, list) {
struct tomoyo_number_group_member *member; struct tomoyo_number_group_member *member;
list_for_each_entry_rcu(member, &group->member_list, list_for_each_entry_rcu(member, &group->member_list,
list) { head.list) {
if (!member->is_deleted) if (!member->head.is_deleted)
continue; continue;
if (tomoyo_add_to_gc(TOMOYO_ID_NUMBER_GROUP_MEMBER, if (tomoyo_add_to_gc(TOMOYO_ID_NUMBER_GROUP_MEMBER,
member)) member))
list_del_rcu(&member->list); list_del_rcu(&member->head.list);
else else
break; break;
} }
......
...@@ -84,10 +84,10 @@ int tomoyo_write_number_group_policy(char *data, const bool is_delete) ...@@ -84,10 +84,10 @@ int tomoyo_write_number_group_policy(char *data, const bool is_delete)
return -ENOMEM; return -ENOMEM;
if (mutex_lock_interruptible(&tomoyo_policy_lock)) if (mutex_lock_interruptible(&tomoyo_policy_lock))
goto out; goto out;
list_for_each_entry_rcu(member, &group->member_list, list) { list_for_each_entry_rcu(member, &group->member_list, head.list) {
if (memcmp(&member->number, &e.number, sizeof(e.number))) if (memcmp(&member->number, &e.number, sizeof(e.number)))
continue; continue;
member->is_deleted = is_delete; member->head.is_deleted = is_delete;
error = 0; error = 0;
break; break;
} }
...@@ -95,7 +95,8 @@ int tomoyo_write_number_group_policy(char *data, const bool is_delete) ...@@ -95,7 +95,8 @@ int tomoyo_write_number_group_policy(char *data, const bool is_delete)
struct tomoyo_number_group_member *entry = struct tomoyo_number_group_member *entry =
tomoyo_commit_ok(&e, sizeof(e)); tomoyo_commit_ok(&e, sizeof(e));
if (entry) { if (entry) {
list_add_tail_rcu(&entry->list, &group->member_list); list_add_tail_rcu(&entry->head.list,
&group->member_list);
error = 0; error = 0;
} }
} }
...@@ -129,8 +130,8 @@ bool tomoyo_read_number_group_policy(struct tomoyo_io_buffer *head) ...@@ -129,8 +130,8 @@ bool tomoyo_read_number_group_policy(struct tomoyo_io_buffer *head)
const struct tomoyo_number_group_member *member const struct tomoyo_number_group_member *member
= list_entry(mpos, = list_entry(mpos,
struct tomoyo_number_group_member, struct tomoyo_number_group_member,
list); head.list);
if (member->is_deleted) if (member->head.is_deleted)
continue; continue;
pos = head->read_avail; pos = head->read_avail;
if (!tomoyo_io_printf(head, TOMOYO_KEYWORD_NUMBER_GROUP if (!tomoyo_io_printf(head, TOMOYO_KEYWORD_NUMBER_GROUP
...@@ -162,8 +163,8 @@ bool tomoyo_number_matches_group(const unsigned long min, ...@@ -162,8 +163,8 @@ bool tomoyo_number_matches_group(const unsigned long min,
{ {
struct tomoyo_number_group_member *member; struct tomoyo_number_group_member *member;
bool matched = false; bool matched = false;
list_for_each_entry_rcu(member, &group->member_list, list) { list_for_each_entry_rcu(member, &group->member_list, head.list) {
if (member->is_deleted) if (member->head.is_deleted)
continue; continue;
if (min > member->number.values[1] || if (min > member->number.values[1] ||
max < member->number.values[0]) max < member->number.values[0])
......
...@@ -79,10 +79,10 @@ int tomoyo_write_path_group_policy(char *data, const bool is_delete) ...@@ -79,10 +79,10 @@ int tomoyo_write_path_group_policy(char *data, const bool is_delete)
goto out; goto out;
if (mutex_lock_interruptible(&tomoyo_policy_lock)) if (mutex_lock_interruptible(&tomoyo_policy_lock))
goto out; goto out;
list_for_each_entry_rcu(member, &group->member_list, list) { list_for_each_entry_rcu(member, &group->member_list, head.list) {
if (member->member_name != e.member_name) if (member->member_name != e.member_name)
continue; continue;
member->is_deleted = is_delete; member->head.is_deleted = is_delete;
error = 0; error = 0;
break; break;
} }
...@@ -90,7 +90,8 @@ int tomoyo_write_path_group_policy(char *data, const bool is_delete) ...@@ -90,7 +90,8 @@ int tomoyo_write_path_group_policy(char *data, const bool is_delete)
struct tomoyo_path_group_member *entry = struct tomoyo_path_group_member *entry =
tomoyo_commit_ok(&e, sizeof(e)); tomoyo_commit_ok(&e, sizeof(e));
if (entry) { if (entry) {
list_add_tail_rcu(&entry->list, &group->member_list); list_add_tail_rcu(&entry->head.list,
&group->member_list);
error = 0; error = 0;
} }
} }
...@@ -122,8 +123,8 @@ bool tomoyo_read_path_group_policy(struct tomoyo_io_buffer *head) ...@@ -122,8 +123,8 @@ bool tomoyo_read_path_group_policy(struct tomoyo_io_buffer *head)
struct tomoyo_path_group_member *member; struct tomoyo_path_group_member *member;
member = list_entry(mpos, member = list_entry(mpos,
struct tomoyo_path_group_member, struct tomoyo_path_group_member,
list); head.list);
if (member->is_deleted) if (member->head.is_deleted)
continue; continue;
if (!tomoyo_io_printf(head, TOMOYO_KEYWORD_PATH_GROUP if (!tomoyo_io_printf(head, TOMOYO_KEYWORD_PATH_GROUP
"%s %s\n", "%s %s\n",
...@@ -150,8 +151,8 @@ bool tomoyo_path_matches_group(const struct tomoyo_path_info *pathname, ...@@ -150,8 +151,8 @@ bool tomoyo_path_matches_group(const struct tomoyo_path_info *pathname,
{ {
struct tomoyo_path_group_member *member; struct tomoyo_path_group_member *member;
bool matched = false; bool matched = false;
list_for_each_entry_rcu(member, &group->member_list, list) { list_for_each_entry_rcu(member, &group->member_list, head.list) {
if (member->is_deleted) if (member->head.is_deleted)
continue; continue;
if (!tomoyo_path_matches_pattern(pathname, if (!tomoyo_path_matches_pattern(pathname,
member->member_name)) member->member_name))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment