@@ -1051,10 +1051,11 @@ bool tomoyo_domain_quota_is_ok(struct tomoyo_request_info *r)
1051
1051
return false;
1052
1052
if (!domain )
1053
1053
return true;
1054
+ if (READ_ONCE (domain -> flags [TOMOYO_DIF_QUOTA_WARNED ]))
1055
+ return false;
1054
1056
list_for_each_entry_rcu (ptr , & domain -> acl_info_list , list ,
1055
1057
srcu_read_lock_held (& tomoyo_ss )) {
1056
1058
u16 perm ;
1057
- u8 i ;
1058
1059
1059
1060
if (ptr -> is_deleted )
1060
1061
continue ;
@@ -1065,45 +1066,41 @@ bool tomoyo_domain_quota_is_ok(struct tomoyo_request_info *r)
1065
1066
*/
1066
1067
switch (ptr -> type ) {
1067
1068
case TOMOYO_TYPE_PATH_ACL :
1068
- data_race ( perm = container_of (ptr , struct tomoyo_path_acl , head )-> perm );
1069
+ perm = data_race ( container_of (ptr , struct tomoyo_path_acl , head )-> perm );
1069
1070
break ;
1070
1071
case TOMOYO_TYPE_PATH2_ACL :
1071
- data_race ( perm = container_of (ptr , struct tomoyo_path2_acl , head )-> perm );
1072
+ perm = data_race ( container_of (ptr , struct tomoyo_path2_acl , head )-> perm );
1072
1073
break ;
1073
1074
case TOMOYO_TYPE_PATH_NUMBER_ACL :
1074
- data_race ( perm = container_of (ptr , struct tomoyo_path_number_acl , head )
1075
+ perm = data_race ( container_of (ptr , struct tomoyo_path_number_acl , head )
1075
1076
-> perm );
1076
1077
break ;
1077
1078
case TOMOYO_TYPE_MKDEV_ACL :
1078
- data_race ( perm = container_of (ptr , struct tomoyo_mkdev_acl , head )-> perm );
1079
+ perm = data_race ( container_of (ptr , struct tomoyo_mkdev_acl , head )-> perm );
1079
1080
break ;
1080
1081
case TOMOYO_TYPE_INET_ACL :
1081
- data_race ( perm = container_of (ptr , struct tomoyo_inet_acl , head )-> perm );
1082
+ perm = data_race ( container_of (ptr , struct tomoyo_inet_acl , head )-> perm );
1082
1083
break ;
1083
1084
case TOMOYO_TYPE_UNIX_ACL :
1084
- data_race ( perm = container_of (ptr , struct tomoyo_unix_acl , head )-> perm );
1085
+ perm = data_race ( container_of (ptr , struct tomoyo_unix_acl , head )-> perm );
1085
1086
break ;
1086
1087
case TOMOYO_TYPE_MANUAL_TASK_ACL :
1087
1088
perm = 0 ;
1088
1089
break ;
1089
1090
default :
1090
1091
perm = 1 ;
1091
1092
}
1092
- for (i = 0 ; i < 16 ; i ++ )
1093
- if (perm & (1 << i ))
1094
- count ++ ;
1093
+ count += hweight16 (perm );
1095
1094
}
1096
1095
if (count < tomoyo_profile (domain -> ns , domain -> profile )->
1097
1096
pref [TOMOYO_PREF_MAX_LEARNING_ENTRY ])
1098
1097
return true;
1099
- if (!domain -> flags [TOMOYO_DIF_QUOTA_WARNED ]) {
1100
- domain -> flags [TOMOYO_DIF_QUOTA_WARNED ] = true;
1101
- /* r->granted = false; */
1102
- tomoyo_write_log (r , "%s" , tomoyo_dif [TOMOYO_DIF_QUOTA_WARNED ]);
1098
+ WRITE_ONCE (domain -> flags [TOMOYO_DIF_QUOTA_WARNED ], true);
1099
+ /* r->granted = false; */
1100
+ tomoyo_write_log (r , "%s" , tomoyo_dif [TOMOYO_DIF_QUOTA_WARNED ]);
1103
1101
#ifndef CONFIG_SECURITY_TOMOYO_INSECURE_BUILTIN_SETTING
1104
- pr_warn ("WARNING: Domain '%s' has too many ACLs to hold. Stopped learning mode.\n" ,
1105
- domain -> domainname -> name );
1102
+ pr_warn ("WARNING: Domain '%s' has too many ACLs to hold. Stopped learning mode.\n" ,
1103
+ domain -> domainname -> name );
1106
1104
#endif
1107
- }
1108
1105
return false;
1109
1106
}
0 commit comments