Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:sel_write_relabel

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

Type:ssize_t

Parameter:

TypeParameterName
struct file *file
char *buf
size_tsize
965  fsi = s_fs_info
966  state = state
967  char * scon = NULL, * tcon = NULL
971  char * newcon = NULL
974  length = avc_has_perm - Check permissions and perform any appropriate auditing
978  If length Then Go to out
981  length = -ENOMEM
982  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).
983  If Not scon Then Go to out
986  length = -ENOMEM
987  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).
988  If Not tcon Then Go to out
991  length = -EINVAL
992  If sscanf - Unformat a buffer into a list of arguments*@buf: input buffer*@fmt: formatting of buffer*@...: resulting arguments != 3 Then Go to out
995  length = security_context_str_to_sid(state, scon, & ssid, GFP_KERNEL)
996  If length Then Go to out
999  length = security_context_str_to_sid(state, tcon, & tsid, GFP_KERNEL)
1000  If length Then Go to out
1003  length = security_change_sid(state, ssid, tsid, tclass, & newsid)
1004  If length Then Go to out
1007  length = security_sid_to_context(state, newsid, & newcon, & len)
1008  If length Then Go to out
1011  length = -ERANGE
1012  If len > SIMPLE_TRANSACTION_LIMIT Then Go to out
1015  memcpy(buf, newcon, len)
1016  length = len
1017  out :
1018  kfree(newcon)
1019  kfree(tcon)
1020  kfree(scon)
1021  Return length