diff options
Diffstat (limited to 'security/tomoyo/common.c')
-rw-r--r-- | security/tomoyo/common.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/security/tomoyo/common.c b/security/tomoyo/common.c index a53ee059da48..0c7ea51e7a45 100644 --- a/security/tomoyo/common.c +++ b/security/tomoyo/common.c | |||
@@ -12,8 +12,8 @@ | |||
12 | #include <linux/uaccess.h> | 12 | #include <linux/uaccess.h> |
13 | #include <linux/security.h> | 13 | #include <linux/security.h> |
14 | #include <linux/hardirq.h> | 14 | #include <linux/hardirq.h> |
15 | #include "realpath.h" | ||
16 | #include "common.h" | 15 | #include "common.h" |
16 | #include "realpath.h" | ||
17 | #include "tomoyo.h" | 17 | #include "tomoyo.h" |
18 | 18 | ||
19 | /* Lock for protecting policy. */ | 19 | /* Lock for protecting policy. */ |
@@ -943,7 +943,9 @@ static int tomoyo_write_profile(struct tomoyo_io_buffer *head) | |||
943 | return -EINVAL; | 943 | return -EINVAL; |
944 | *cp = '\0'; | 944 | *cp = '\0'; |
945 | if (!strcmp(data, "COMMENT")) { | 945 | if (!strcmp(data, "COMMENT")) { |
946 | profile->comment = tomoyo_save_name(cp + 1); | 946 | const struct tomoyo_path_info *old_comment = profile->comment; |
947 | profile->comment = tomoyo_get_name(cp + 1); | ||
948 | tomoyo_put_name(old_comment); | ||
947 | return 0; | 949 | return 0; |
948 | } | 950 | } |
949 | for (i = 0; i < TOMOYO_MAX_CONTROL_INDEX; i++) { | 951 | for (i = 0; i < TOMOYO_MAX_CONTROL_INDEX; i++) { |
@@ -1117,7 +1119,7 @@ static int tomoyo_update_manager_entry(const char *manager, | |||
1117 | if (!tomoyo_is_correct_path(manager, 1, -1, -1, __func__)) | 1119 | if (!tomoyo_is_correct_path(manager, 1, -1, -1, __func__)) |
1118 | return -EINVAL; | 1120 | return -EINVAL; |
1119 | } | 1121 | } |
1120 | saved_manager = tomoyo_save_name(manager); | 1122 | saved_manager = tomoyo_get_name(manager); |
1121 | if (!saved_manager) | 1123 | if (!saved_manager) |
1122 | return -ENOMEM; | 1124 | return -ENOMEM; |
1123 | if (!is_delete) | 1125 | if (!is_delete) |
@@ -1132,12 +1134,14 @@ static int tomoyo_update_manager_entry(const char *manager, | |||
1132 | } | 1134 | } |
1133 | if (!is_delete && error && tomoyo_memory_ok(entry)) { | 1135 | if (!is_delete && error && tomoyo_memory_ok(entry)) { |
1134 | entry->manager = saved_manager; | 1136 | entry->manager = saved_manager; |
1137 | saved_manager = NULL; | ||
1135 | entry->is_domain = is_domain; | 1138 | entry->is_domain = is_domain; |
1136 | list_add_tail_rcu(&entry->list, &tomoyo_policy_manager_list); | 1139 | list_add_tail_rcu(&entry->list, &tomoyo_policy_manager_list); |
1137 | entry = NULL; | 1140 | entry = NULL; |
1138 | error = 0; | 1141 | error = 0; |
1139 | } | 1142 | } |
1140 | mutex_unlock(&tomoyo_policy_lock); | 1143 | mutex_unlock(&tomoyo_policy_lock); |
1144 | tomoyo_put_name(saved_manager); | ||
1141 | kfree(entry); | 1145 | kfree(entry); |
1142 | return error; | 1146 | return error; |
1143 | } | 1147 | } |