Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:sel_write_member

Proto:static ssize_t sel_write_member(struct file *file, char *buf, size_t size)

Type:ssize_t

Parameter:

TypeParameterName
struct file *file
char *buf
size_tsize
1091  fsi = s_fs_info
1092  state = state
1093  char * scon = NULL, * tcon = NULL
1097  char * newcon = NULL
1100  length = avc_has_perm - Check permissions and perform any appropriate auditing
1104  If length Then Go to out
1107  length = -ENOMEM
1108  scon = kzalloc - allocate memory. The memory is set to zero.*@size: how many bytes of memory are required.*@flags: the type of memory to allocate (see kmalloc).
1109  If Not scon Then Go to out
1112  length = -ENOMEM
1113  tcon = kzalloc - allocate memory. The memory is set to zero.*@size: how many bytes of memory are required.*@flags: the type of memory to allocate (see kmalloc).
1114  If Not tcon Then Go to out
1117  length = -EINVAL
1118  If sscanf - Unformat a buffer into a list of arguments*@buf: input buffer*@fmt: formatting of buffer*@...: resulting arguments != 3 Then Go to out
1121  length = security_context_str_to_sid(state, scon, & ssid, GFP_KERNEL)
1122  If length Then Go to out
1125  length = security_context_str_to_sid(state, tcon, & tsid, GFP_KERNEL)
1126  If length Then Go to out
1129  length = security_member_sid(state, ssid, tsid, tclass, & newsid)
1130  If length Then Go to out
1133  length = security_sid_to_context(state, newsid, & newcon, & len)
1134  If length Then Go to out
1137  length = -ERANGE
1138  If len > SIMPLE_TRANSACTION_LIMIT Then
1139  pr_err("SELinux: %s: context size (%u) exceeds payload max\n", __func__, len)
1141  Go to out
1144  memcpy(buf, newcon, len)
1145  length = len
1146  out :
1147  kfree(newcon)
1148  kfree(tcon)
1149  kfree(scon)
1150  Return length