Skip to content

Commit cb917cf

Browse files
Tetsuo Handaxjamesmorris
authored andcommitted
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>
1 parent 71c2823 commit cb917cf

1 file changed

Lines changed: 9 additions & 41 deletions

File tree

‎security/tomoyo/file.c‎

Lines changed: 9 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -265,14 +265,6 @@ static int tomoyo_audit_path_number_log(struct tomoyo_request_info *r)
265265
tomoyo_file_pattern(filename), buffer);
266266
}
267267

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-
276268
/*
277269
* tomoyo_globally_readable_list is used for holding list of pathnames which
278270
* are by default allowed to be open()ed for reading by any process.
@@ -1045,37 +1037,6 @@ static int tomoyo_update_path_number_acl(const u8 type, const char *filename,
10451037
return error;
10461038
}
10471039

1048-
/**
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-
10791040
/**
10801041
* tomoyo_path_number_perm - Check permission for "create", "mkdir", "mkfifo", "mksock", "ioctl", "chmod", "chown", "chgrp".
10811042
*
@@ -1101,9 +1062,16 @@ int tomoyo_path_number_perm(const u8 type, struct path *path,
11011062
goto out;
11021063
if (type == TOMOYO_TYPE_MKDIR)
11031064
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);
11061073
kfree(buf.name);
1074+
out:
11071075
tomoyo_read_unlock(idx);
11081076
if (r.mode != TOMOYO_CONFIG_ENFORCING)
11091077
error = 0;

0 commit comments

Comments
 (0)