Commit cb917cf517075a357ce43b74e8a5a57f2c69a734
Committed by
James Morris
1 parent
71c282362d
Exists in
master
and in
7 other branches
TOMOYO: Merge functions.
Embed tomoyo_path_number_perm2() into tomoyo_path_number_perm(). Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> Signed-off-by: James Morris <jmorris@namei.org>
Showing 1 changed file with 9 additions and 41 deletions Side-by-side Diff
security/tomoyo/file.c
... | ... | @@ -265,14 +265,6 @@ |
265 | 265 | tomoyo_file_pattern(filename), buffer); |
266 | 266 | } |
267 | 267 | |
268 | -static int tomoyo_update_path2_acl(const u8 type, const char *filename1, | |
269 | - const char *filename2, | |
270 | - struct tomoyo_domain_info *const domain, | |
271 | - const bool is_delete); | |
272 | -static int tomoyo_update_path_acl(const u8 type, const char *filename, | |
273 | - struct tomoyo_domain_info *const domain, | |
274 | - const bool is_delete); | |
275 | - | |
276 | 268 | /* |
277 | 269 | * tomoyo_globally_readable_list is used for holding list of pathnames which |
278 | 270 | * are by default allowed to be open()ed for reading by any process. |
... | ... | @@ -1046,37 +1038,6 @@ |
1046 | 1038 | } |
1047 | 1039 | |
1048 | 1040 | /** |
1049 | - * tomoyo_path_number_perm2 - Check permission for "create", "mkdir", "mkfifo", "mksock", "ioctl", "chmod", "chown", "chgrp". | |
1050 | - * | |
1051 | - * @r: Pointer to "strct tomoyo_request_info". | |
1052 | - * @filename: Filename to check. | |
1053 | - * @number: Number. | |
1054 | - * | |
1055 | - * Returns 0 on success, negative value otherwise. | |
1056 | - * | |
1057 | - * Caller holds tomoyo_read_lock(). | |
1058 | - */ | |
1059 | -static int tomoyo_path_number_perm2(struct tomoyo_request_info *r, | |
1060 | - const u8 type, | |
1061 | - const struct tomoyo_path_info *filename, | |
1062 | - const unsigned long number) | |
1063 | -{ | |
1064 | - int error; | |
1065 | - | |
1066 | - if (!filename) | |
1067 | - return 0; | |
1068 | - r->param_type = TOMOYO_TYPE_PATH_NUMBER_ACL; | |
1069 | - r->param.path_number.operation = type; | |
1070 | - r->param.path_number.filename = filename; | |
1071 | - r->param.path_number.number = number; | |
1072 | - do { | |
1073 | - tomoyo_check_acl(r, tomoyo_check_path_number_acl); | |
1074 | - error = tomoyo_audit_path_number_log(r); | |
1075 | - } while (error == TOMOYO_RETRY_REQUEST); | |
1076 | - return error; | |
1077 | -} | |
1078 | - | |
1079 | -/** | |
1080 | 1041 | * tomoyo_path_number_perm - Check permission for "create", "mkdir", "mkfifo", "mksock", "ioctl", "chmod", "chown", "chgrp". |
1081 | 1042 | * |
1082 | 1043 | * @type: Type of operation. |
1083 | 1044 | |
... | ... | @@ -1101,9 +1062,16 @@ |
1101 | 1062 | goto out; |
1102 | 1063 | if (type == TOMOYO_TYPE_MKDIR) |
1103 | 1064 | tomoyo_add_slash(&buf); |
1104 | - error = tomoyo_path_number_perm2(&r, type, &buf, number); | |
1105 | - out: | |
1065 | + r.param_type = TOMOYO_TYPE_PATH_NUMBER_ACL; | |
1066 | + r.param.path_number.operation = type; | |
1067 | + r.param.path_number.filename = &buf; | |
1068 | + r.param.path_number.number = number; | |
1069 | + do { | |
1070 | + tomoyo_check_acl(&r, tomoyo_check_path_number_acl); | |
1071 | + error = tomoyo_audit_path_number_log(&r); | |
1072 | + } while (error == TOMOYO_RETRY_REQUEST); | |
1106 | 1073 | kfree(buf.name); |
1074 | + out: | |
1107 | 1075 | tomoyo_read_unlock(idx); |
1108 | 1076 | if (r.mode != TOMOYO_CONFIG_ENFORCING) |
1109 | 1077 | error = 0; |