Function report |
Source Code:security\device_cgroup.c |
Create Date:2022-07-28 19:55:51 |
| Last Modify:2020-03-12 14:18:49 | Copyright©Brick |
| home page | Tree |
| Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:Modify the exception list using allow/deny rules
Proto:static int devcgroup_update_access(struct dev_cgroup *devcgroup, int filetype, char *buffer)
Type:int
Parameter:
| Type | Parameter | Name |
|---|---|---|
| struct dev_cgroup * | devcgroup | |
| int | filetype | |
| char * | buffer |
| 600 | rc = 0 |
| 602 | parent = css_to_devcgroup(PI: the parent css. Placed here for cache proximity to following* fields of the containing structure.) |
| 604 | If Not Check operation authority Then Return -EPERM |
| 611 | Case b == 'a' |
| 613 | Case filetype == DEVCG_ALLOW |
| 620 | behavior = DEVCG_DEFAULT_ALLOW |
| 621 | If Not parent Then Break |
| 628 | Break |
| 629 | Case filetype == DEVCG_DENY |
| 634 | behavior = DEVCG_DEFAULT_DENY |
| 635 | Break |
| 636 | Default |
| 637 | Return -EINVAL |
| 639 | Return 0 |
| 640 | Case b == 'b' |
| 641 | type = DEVCG_DEV_BLOCK |
| 642 | Break |
| 643 | Case b == 'c' |
| 644 | type = DEVCG_DEV_CHAR |
| 645 | Break |
| 646 | Default |
| 647 | Return -EINVAL |
| 649 | b++ |
| 650 | If Not Note: isspace() must return false for %NUL-terminator ( * b) Then Return -EINVAL |
| 652 | b++ |
| 653 | If b == '*' Then |
| 667 | Else |
| 668 | Return -EINVAL |
| 672 | b++ |
| 675 | If b == '*' Then |
| 689 | Else |
| 690 | Return -EINVAL |
| 692 | If Not Note: isspace() must return false for %NUL-terminator ( * b) Then Return -EINVAL |
| 696 | Case b == 'r' |
| 697 | access |= DEVCG_ACC_READ |
| 698 | Break |
| 699 | Case b == 'w' |
| 700 | access |= DEVCG_ACC_WRITE |
| 701 | Break |
| 702 | Case b == 'm' |
| 703 | access |= DEVCG_ACC_MKNOD |
| 704 | Break |
| 705 | Case b == '\n' |
| 706 | Case b == '\0' |
| 707 | count = 3 |
| 708 | Break |
| 709 | Default |
| 710 | Return -EINVAL |
| 715 | Case filetype == DEVCG_ALLOW |
| 721 | If behavior == DEVCG_DEFAULT_ALLOW Then |
| 726 | Break |
| 729 | If Not parent_has_perm:* when adding a new allow rule to a device exception list, the rule* must be allowed in the parent device Then Return -EPERM |
| 732 | Break |
| 733 | Case filetype == DEVCG_DENY |
| 739 | If behavior == DEVCG_DEFAULT_DENY Then alled under devcgroup_mutex |
| 741 | Else rc = alled under devcgroup_mutex |
| 744 | If rc Then Break |
| 748 | Break |
| 749 | Default |
| 752 | Return rc |
| Name | Describe |
|---|---|
| devcgroup_access_write |
| 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 |