Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:sel_write_validatetrans

Proto:static ssize_t sel_write_validatetrans(struct file *file, const char __user *buf, size_t count, loff_t *ppos)

Type:ssize_t

Parameter:

TypeParameterName
struct file *file
const char __user *buf
size_tcount
loff_t *ppos
681  fsi = s_fs_info
682  state = state
683  char * oldcon = NULL, * newcon = NULL, * taskcon = NULL
684  char * req = NULL
689  rc = avc_has_perm - Check permissions and perform any appropriate auditing
692  If rc Then Go to out
695  rc = -ENOMEM
696  If count >= PAGE_SIZE Then Go to out
700  rc = -EINVAL
701  If ppos != 0 Then Go to out
704  req = memdup_user_nul - duplicate memory region from user space and NUL-terminate*@src: source address in user space*@len: number of bytes to copy* Return: an ERR_PTR() on failure.
705  If IS_ERR(req) Then
706  rc = PTR_ERR(req)
707  req = NULL
708  Go to out
711  rc = -ENOMEM
712  oldcon = 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).
713  If Not oldcon Then Go to out
716  newcon = 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).
717  If Not newcon Then Go to out
720  taskcon = 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).
721  If Not taskcon Then Go to out
724  rc = -EINVAL
725  If sscanf - Unformat a buffer into a list of arguments*@buf: input buffer*@fmt: formatting of buffer*@...: resulting arguments != 4 Then Go to out
728  rc = security_context_str_to_sid(state, oldcon, & osid, GFP_KERNEL)
729  If rc Then Go to out
732  rc = security_context_str_to_sid(state, newcon, & nsid, GFP_KERNEL)
733  If rc Then Go to out
736  rc = security_context_str_to_sid(state, taskcon, & tsid, GFP_KERNEL)
737  If rc Then Go to out
740  rc = security_validate_transition_user(state, osid, nsid, tsid, tclass)
741  If Not rc Then rc = count
743  out :
744  kfree(req)
745  kfree(oldcon)
746  kfree(newcon)
747  kfree(taskcon)
748  Return rc