Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:smk_write_rules_list - write() for any /smack rule file*@file: file pointer, not actually used*@buf: where to get the data from*@count: bytes sent*@ppos: where to start - must be 0*@rule_list: the list of rules to write to*@rule_lock: lock for the rule

Proto:static ssize_t smk_write_rules_list(struct file *file, const char __user *buf, size_t count, loff_t *ppos, struct list_head *rule_list, struct mutex *rule_lock, int format)

Type:ssize_t

Parameter:

TypeParameterName
struct file *file
const char __user *buf
size_tcount
loff_t *ppos
struct list_head *rule_list
struct mutex *rule_lock
intformat
451  trunc = 0
453  cnt = 0
459  If ppos != 0 Then Return -EINVAL
462  If format == Fixed 24byte label format Then
466  If count < SMK_OLOADLEN || count > SMK_LOADLEN Then Return -EINVAL
468  Else
469  If count >= PAGE_SIZE Then
470  count = PAGE_SIZE - 1
471  trunc = 1
475  data = 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.
476  If IS_ERR(data) Then Return PTR_ERR(data)
483  If trunc Then
484  When count > 0 && data[count - 1] != '\n' cycle
485  --count
486  If count == 0 Then
487  rc = -EINVAL
488  Go to out
492  data[count] = '\0'
493  tokens = If format == Rule modification format Then 4 Else 3
494  When cnt < count cycle
497  If rc < 0 Then Go to out
499  cnt = count
500  Else
502  If rc < 0 Then Go to out
504  If rc == 0 Then
505  rc = -EINVAL
506  Go to out
508  cnt += rc
511  If (rule_list == NULL) Then rc = smk_set_access - add a rule to the rule list or replace an old rule*@srp: the rule to add or replace*@rule_list: the list of rules*@rule_lock: the rule list lock* Looks through the current subject/object/access list for* the subject/object pair and
514  Else rc = smk_set_access - add a rule to the rule list or replace an old rule*@srp: the rule to add or replace*@rule_list: the list of rules*@rule_lock: the rule list lock* Looks through the current subject/object/access list for* the subject/object pair and
517  If rc Then Go to out
521  rc = cnt
522  out :
523  kfree(data)
524  Return rc
Caller
NameDescribe
smk_write_loadsmk_write_load - write() for /smack/load*@file: file pointer, not actually used*@buf: where to get the data from*@count: bytes sent*@ppos: where to start - must be 0
smk_write_load_selfsmk_write_load_self - write() for /smack/load-self*@file: file pointer, not actually used*@buf: where to get the data from*@count: bytes sent*@ppos: where to start - must be 0
smk_write_load2smk_write_load2 - write() for /smack/load2*@file: file pointer, not actually used*@buf: where to get the data from*@count: bytes sent*@ppos: where to start - must be 0
smk_write_load_self2smk_write_load_self2 - write() for /smack/load-self2*@file: file pointer, not actually used*@buf: where to get the data from*@count: bytes sent*@ppos: where to start - must be 0
smk_write_change_rulesmk_write_change_rule - write() for /smack/change-rule*@file: file pointer*@buf: data from user space*@count: bytes sent*@ppos: where to start - must be 0