.. | .. |
---|
77 | 77 | spin_lock(&tomoyo_io_buffer_list_lock); |
---|
78 | 78 | list_for_each_entry(head, &tomoyo_io_buffer_list, list) { |
---|
79 | 79 | int i; |
---|
| 80 | + |
---|
80 | 81 | head->users++; |
---|
81 | 82 | spin_unlock(&tomoyo_io_buffer_list_lock); |
---|
82 | 83 | mutex_lock(&head->io_sem); |
---|
83 | 84 | for (i = 0; i < TOMOYO_MAX_IO_READ_QUEUE; i++) { |
---|
84 | 85 | const char *w = head->r.w[i]; |
---|
| 86 | + |
---|
85 | 87 | if (w < string || w > string + size) |
---|
86 | 88 | continue; |
---|
87 | 89 | in_use = true; |
---|
.. | .. |
---|
108 | 110 | { |
---|
109 | 111 | struct tomoyo_transition_control *ptr = |
---|
110 | 112 | container_of(element, typeof(*ptr), head.list); |
---|
| 113 | + |
---|
111 | 114 | tomoyo_put_name(ptr->domainname); |
---|
112 | 115 | tomoyo_put_name(ptr->program); |
---|
113 | 116 | } |
---|
.. | .. |
---|
123 | 126 | { |
---|
124 | 127 | struct tomoyo_aggregator *ptr = |
---|
125 | 128 | container_of(element, typeof(*ptr), head.list); |
---|
| 129 | + |
---|
126 | 130 | tomoyo_put_name(ptr->original_name); |
---|
127 | 131 | tomoyo_put_name(ptr->aggregated_name); |
---|
128 | 132 | } |
---|
.. | .. |
---|
138 | 142 | { |
---|
139 | 143 | struct tomoyo_manager *ptr = |
---|
140 | 144 | container_of(element, typeof(*ptr), head.list); |
---|
| 145 | + |
---|
141 | 146 | tomoyo_put_name(ptr->manager); |
---|
142 | 147 | } |
---|
143 | 148 | |
---|
.. | .. |
---|
152 | 157 | { |
---|
153 | 158 | struct tomoyo_acl_info *acl = |
---|
154 | 159 | container_of(element, typeof(*acl), list); |
---|
| 160 | + |
---|
155 | 161 | tomoyo_put_condition(acl->cond); |
---|
156 | 162 | switch (acl->type) { |
---|
157 | 163 | case TOMOYO_TYPE_PATH_ACL: |
---|
.. | .. |
---|
226 | 232 | { |
---|
227 | 233 | struct tomoyo_task_acl *entry = |
---|
228 | 234 | container_of(acl, typeof(*entry), head); |
---|
| 235 | + |
---|
229 | 236 | tomoyo_put_name(entry->domainname); |
---|
230 | 237 | } |
---|
231 | 238 | break; |
---|
.. | .. |
---|
247 | 254 | container_of(element, typeof(*domain), list); |
---|
248 | 255 | struct tomoyo_acl_info *acl; |
---|
249 | 256 | struct tomoyo_acl_info *tmp; |
---|
| 257 | + |
---|
250 | 258 | /* |
---|
251 | 259 | * Since this domain is referenced from neither |
---|
252 | 260 | * "struct tomoyo_io_buffer" nor "struct cred"->security, we can delete |
---|
.. | .. |
---|
286 | 294 | = (const struct tomoyo_argv *) (names_p + names_count); |
---|
287 | 295 | const struct tomoyo_envp *envp |
---|
288 | 296 | = (const struct tomoyo_envp *) (argv + argc); |
---|
| 297 | + |
---|
289 | 298 | for (i = 0; i < numbers_count; i++) |
---|
290 | 299 | tomoyo_put_number_union(numbers_p++); |
---|
291 | 300 | for (i = 0; i < names_count; i++) |
---|
.. | .. |
---|
321 | 330 | { |
---|
322 | 331 | struct tomoyo_path_group *member = |
---|
323 | 332 | container_of(element, typeof(*member), head.list); |
---|
| 333 | + |
---|
324 | 334 | tomoyo_put_name(member->member_name); |
---|
325 | 335 | } |
---|
326 | 336 | |
---|
.. | .. |
---|
335 | 345 | { |
---|
336 | 346 | struct tomoyo_group *group = |
---|
337 | 347 | container_of(element, typeof(*group), head.list); |
---|
| 348 | + |
---|
338 | 349 | tomoyo_put_name(group->group_name); |
---|
339 | 350 | } |
---|
340 | 351 | |
---|
.. | .. |
---|
476 | 487 | { |
---|
477 | 488 | struct tomoyo_acl_head *member; |
---|
478 | 489 | struct tomoyo_acl_head *tmp; |
---|
| 490 | + |
---|
479 | 491 | list_for_each_entry_safe(member, tmp, member_list, list) { |
---|
480 | 492 | if (!member->is_deleted) |
---|
481 | 493 | continue; |
---|
.. | .. |
---|
495 | 507 | { |
---|
496 | 508 | struct tomoyo_acl_info *acl; |
---|
497 | 509 | struct tomoyo_acl_info *tmp; |
---|
| 510 | + |
---|
498 | 511 | list_for_each_entry_safe(acl, tmp, list, list) { |
---|
499 | 512 | if (!acl->is_deleted) |
---|
500 | 513 | continue; |
---|
.. | .. |
---|
513 | 526 | int i; |
---|
514 | 527 | enum tomoyo_policy_id id; |
---|
515 | 528 | struct tomoyo_policy_namespace *ns; |
---|
| 529 | + |
---|
516 | 530 | mutex_lock(&tomoyo_policy_lock); |
---|
517 | 531 | { |
---|
518 | 532 | struct tomoyo_domain_info *domain; |
---|
519 | 533 | struct tomoyo_domain_info *tmp; |
---|
| 534 | + |
---|
520 | 535 | list_for_each_entry_safe(domain, tmp, &tomoyo_domain_list, |
---|
521 | 536 | list) { |
---|
522 | 537 | tomoyo_collect_acl(&domain->acl_info_list); |
---|
.. | .. |
---|
534 | 549 | { |
---|
535 | 550 | struct tomoyo_shared_acl_head *ptr; |
---|
536 | 551 | struct tomoyo_shared_acl_head *tmp; |
---|
| 552 | + |
---|
537 | 553 | list_for_each_entry_safe(ptr, tmp, &tomoyo_condition_list, |
---|
538 | 554 | list) { |
---|
539 | 555 | if (atomic_read(&ptr->users) > 0) |
---|
.. | .. |
---|
547 | 563 | struct list_head *list = &ns->group_list[i]; |
---|
548 | 564 | struct tomoyo_group *group; |
---|
549 | 565 | struct tomoyo_group *tmp; |
---|
| 566 | + |
---|
550 | 567 | switch (i) { |
---|
551 | 568 | case 0: |
---|
552 | 569 | id = TOMOYO_ID_PATH_GROUP; |
---|
.. | .. |
---|
574 | 591 | struct list_head *list = &tomoyo_name_list[i]; |
---|
575 | 592 | struct tomoyo_shared_acl_head *ptr; |
---|
576 | 593 | struct tomoyo_shared_acl_head *tmp; |
---|
| 594 | + |
---|
577 | 595 | list_for_each_entry_safe(ptr, tmp, list, list) { |
---|
578 | 596 | if (atomic_read(&ptr->users) > 0) |
---|
579 | 597 | continue; |
---|
.. | .. |
---|
595 | 613 | { |
---|
596 | 614 | /* Garbage collector thread is exclusive. */ |
---|
597 | 615 | static DEFINE_MUTEX(tomoyo_gc_mutex); |
---|
| 616 | + |
---|
598 | 617 | if (!mutex_trylock(&tomoyo_gc_mutex)) |
---|
599 | 618 | goto out; |
---|
600 | 619 | tomoyo_collect_entry(); |
---|