Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:security\tomoyo\memory.c Create Date:2022-07-28 19:43:58
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:moyo_get_group - Allocate memory for "struct tomoyo_path_group"/"struct tomoyo_number_group".*@param: Pointer to "struct tomoyo_acl_param".*@idx: Index number.* Returns pointer to "struct tomoyo_group" on success, NULL otherwise.

Proto:struct tomoyo_group *tomoyo_get_group(struct tomoyo_acl_param *param, const u8 idx)

Type:struct tomoyo_group

Parameter:

TypeParameterName
struct tomoyo_acl_param *param
const u8idx
98  struct tomoyo_group e = {}
99  struct tomoyo_group * group = NULL
101  group_name = tomoyo_read_token(param)
102  bool found = false
104  If Not tomoyo_correct_word(group_name) || idx >= TOMOYO_MAX_GROUP Then Return NULL
106  group_name = moyo_get_name - Allocate permanent memory for string data.*@name: The string to store into the permernent memory.* Returns pointer to "struct tomoyo_path_info" on success, NULL otherwise.
107  If Not group_name Then Return NULL
109  If mutex_lock_interruptible( & tomoyo_policy_lock) Then Go to out
111  list = List of "struct tomoyo_group". [idx]
113  If group_name != group_name || atomic_read( & users) == Garbage collector is trying to kfree() this element. Then Continue
116  atomic_inc( & users)
117  found = true
118  Break
120  If Not found Then
121  entry = moyo_commit_ok - Check memory quota.*@data: Data to copy from.*@size: Size in byte.* Returns pointer to allocated memory on success, NULL otherwise.*@data is zero-cleared on success.* Caller holds tomoyo_policy_lock mutex.
123  If entry Then
125  atomic_set( & users, 1)
127  group = entry
128  found = true
131  mutex_unlock - release the mutex*@lock: the mutex to be released* Unlock a mutex that has been locked by this task previously.* This function must not be used in interrupt context. Unlocking* of a not locked mutex is not allowed.
132  out :
133  moyo_put_name - Drop reference on "struct tomoyo_name".*@name: Pointer to "struct tomoyo_path_info". Maybe NULL.* Returns nothing.
134  Return found ? group : NULL
Caller
NameDescribe
tomoyo_write_inet_networkmoyo_write_inet_network - Write "struct tomoyo_inet_acl" list.*@param: Pointer to "struct tomoyo_acl_param".* Returns 0 on success, negative value otherwise.* Caller holds tomoyo_read_lock().
tomoyo_parse_name_unionmoyo_parse_name_union - Parse a tomoyo_name_union.*@param: Pointer to "struct tomoyo_acl_param".*@ptr: Pointer to "struct tomoyo_name_union".* Returns true on success, false otherwise.
tomoyo_parse_number_unionmoyo_parse_number_union - Parse a tomoyo_number_union.*@param: Pointer to "struct tomoyo_acl_param".*@ptr: Pointer to "struct tomoyo_number_union".* Returns true on success, false otherwise.
tomoyo_write_groupmoyo_write_group - Write "struct tomoyo_path_group"/"struct tomoyo_number_group"/"struct tomoyo_address_group" list.*@param: Pointer to "struct tomoyo_acl_param".*@type: Type of this group.* Returns 0 on success, negative value otherwise.