Function report |
Source Code:security\smack\smackfs.c |
Create Date:2022-07-28 19:27:40 |
| Last Modify:2020-03-12 14:18:49 | Copyright©Brick |
| home page | Tree |
| Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:smk_write_net4addr - write() for /smack/netlabel*@file: file pointer, not actually used*@buf: where to get the data from*@count: bytes sent*@ppos: where to start* Accepts only one net4addr per write call
Proto:static ssize_t smk_write_net4addr(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
Type:ssize_t
Parameter:
| Type | Parameter | Name |
|---|---|---|
| struct file * | file | |
| const char __user * | buf | |
| size_t | count | |
| loff_t * | ppos |
| 1128 | struct smack_known * skp = NULL |
| 1137 | mask_bits = 1 << 31 |
| 1152 | If count < Value for parsing single label host rules* "1.2.3.4 X" Then Return -EINVAL |
| 1155 | 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. |
| 1159 | smack = 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). |
| 1160 | If (smack == NULL) Then |
| 1162 | Go to free_data_out |
| 1165 | rc = sscanf - Unformat a buffer into a list of arguments*@buf: input buffer*@fmt: formatting of buffer*@...: resulting arguments |
| 1167 | If rc != 6 Then |
| 1168 | rc = sscanf - Unformat a buffer into a list of arguments*@buf: input buffer*@fmt: formatting of buffer*@...: resulting arguments |
| 1170 | If rc != 5 Then |
| 1175 | masks = 32 |
| 1185 | If smack[0] != '-' Then |
| 1191 | Else |
| 1205 | s_addr = cpu_to_be32(temp_mask) |
| 1212 | mutex_lock( & smk_net4addr_lock) |
| 1216 | found = 0 |
| 1219 | found = 1 |
| 1220 | Break |
| 1225 | If found == 0 Then |
| 1226 | snp = 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). |
| 1229 | Else |
| 1230 | rc = 0 |
| 1237 | Else |
| 1242 | If (label != NULL) Then rc = netlbl_cfg_unlbl_static_del( & init_net, NULL, & work address , & work mask , PF_INET, & audit_info) |
| 1246 | Else rc = 0 |
| 1256 | If (rc == 0 && skp != NULL) Then rc = netlbl_cfg_unlbl_static_add( & init_net, NULL, & work address , & work mask , PF_INET, smk_secid, & audit_info) |
| 1266 | free_out : |
| 1268 | free_data_out : |
| 1271 | Return rc |
| Source code conversion tool public plug-in interface | X |
|---|---|
| Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion |