diff options
| -rw-r--r-- | security/tomoyo/common.c | 41 | ||||
| -rw-r--r-- | security/tomoyo/domain.c | 31 | ||||
| -rw-r--r-- | security/tomoyo/file.c | 21 |
3 files changed, 41 insertions, 52 deletions
diff --git a/security/tomoyo/common.c b/security/tomoyo/common.c index a42fe02c614..6d2561276a7 100644 --- a/security/tomoyo/common.c +++ b/security/tomoyo/common.c | |||
| @@ -1113,10 +1113,9 @@ static int tomoyo_read_manager_policy(struct tomoyo_io_buffer *head) | |||
| 1113 | list); | 1113 | list); |
| 1114 | if (ptr->is_deleted) | 1114 | if (ptr->is_deleted) |
| 1115 | continue; | 1115 | continue; |
| 1116 | if (!tomoyo_io_printf(head, "%s\n", ptr->manager->name)) { | 1116 | done = tomoyo_io_printf(head, "%s\n", ptr->manager->name); |
| 1117 | done = false; | 1117 | if (!done) |
| 1118 | break; | 1118 | break; |
| 1119 | } | ||
| 1120 | } | 1119 | } |
| 1121 | up_read(&tomoyo_policy_manager_list_lock); | 1120 | up_read(&tomoyo_policy_manager_list_lock); |
| 1122 | head->read_eof = done; | 1121 | head->read_eof = done; |
| @@ -1441,15 +1440,14 @@ static int tomoyo_read_domain_policy(struct tomoyo_io_buffer *head) | |||
| 1441 | TOMOYO_DOMAIN_FLAGS_IGNORE_GLOBAL_ALLOW_READ) | 1440 | TOMOYO_DOMAIN_FLAGS_IGNORE_GLOBAL_ALLOW_READ) |
| 1442 | ignore_global_allow_read | 1441 | ignore_global_allow_read |
| 1443 | = TOMOYO_KEYWORD_IGNORE_GLOBAL_ALLOW_READ "\n"; | 1442 | = TOMOYO_KEYWORD_IGNORE_GLOBAL_ALLOW_READ "\n"; |
| 1444 | if (!tomoyo_io_printf(head, | 1443 | done = tomoyo_io_printf(head, "%s\n" TOMOYO_KEYWORD_USE_PROFILE |
| 1445 | "%s\n" TOMOYO_KEYWORD_USE_PROFILE "%u\n" | 1444 | "%u\n%s%s%s\n", |
| 1446 | "%s%s%s\n", domain->domainname->name, | 1445 | domain->domainname->name, |
| 1447 | domain->profile, quota_exceeded, | 1446 | domain->profile, quota_exceeded, |
| 1448 | transition_failed, | 1447 | transition_failed, |
| 1449 | ignore_global_allow_read)) { | 1448 | ignore_global_allow_read); |
| 1450 | done = false; | 1449 | if (!done) |
| 1451 | break; | 1450 | break; |
| 1452 | } | ||
| 1453 | head->read_step = 2; | 1451 | head->read_step = 2; |
| 1454 | acl_loop: | 1452 | acl_loop: |
| 1455 | if (head->read_step == 3) | 1453 | if (head->read_step == 3) |
| @@ -1457,24 +1455,22 @@ acl_loop: | |||
| 1457 | /* Print ACL entries in the domain. */ | 1455 | /* Print ACL entries in the domain. */ |
| 1458 | down_read(&tomoyo_domain_acl_info_list_lock); | 1456 | down_read(&tomoyo_domain_acl_info_list_lock); |
| 1459 | list_for_each_cookie(apos, head->read_var2, | 1457 | list_for_each_cookie(apos, head->read_var2, |
| 1460 | &domain->acl_info_list) { | 1458 | &domain->acl_info_list) { |
| 1461 | struct tomoyo_acl_info *ptr | 1459 | struct tomoyo_acl_info *ptr |
| 1462 | = list_entry(apos, struct tomoyo_acl_info, | 1460 | = list_entry(apos, struct tomoyo_acl_info, |
| 1463 | list); | 1461 | list); |
| 1464 | if (!tomoyo_print_entry(head, ptr)) { | 1462 | done = tomoyo_print_entry(head, ptr); |
| 1465 | done = false; | 1463 | if (!done) |
| 1466 | break; | 1464 | break; |
| 1467 | } | ||
| 1468 | } | 1465 | } |
| 1469 | up_read(&tomoyo_domain_acl_info_list_lock); | 1466 | up_read(&tomoyo_domain_acl_info_list_lock); |
| 1470 | if (!done) | 1467 | if (!done) |
| 1471 | break; | 1468 | break; |
| 1472 | head->read_step = 3; | 1469 | head->read_step = 3; |
| 1473 | tail_mark: | 1470 | tail_mark: |
| 1474 | if (!tomoyo_io_printf(head, "\n")) { | 1471 | done = tomoyo_io_printf(head, "\n"); |
| 1475 | done = false; | 1472 | if (!done) |
| 1476 | break; | 1473 | break; |
| 1477 | } | ||
| 1478 | head->read_step = 1; | 1474 | head->read_step = 1; |
| 1479 | if (head->read_single_domain) | 1475 | if (head->read_single_domain) |
| 1480 | break; | 1476 | break; |
| @@ -1544,11 +1540,10 @@ static int tomoyo_read_domain_profile(struct tomoyo_io_buffer *head) | |||
| 1544 | domain = list_entry(pos, struct tomoyo_domain_info, list); | 1540 | domain = list_entry(pos, struct tomoyo_domain_info, list); |
| 1545 | if (domain->is_deleted) | 1541 | if (domain->is_deleted) |
| 1546 | continue; | 1542 | continue; |
| 1547 | if (!tomoyo_io_printf(head, "%u %s\n", domain->profile, | 1543 | done = tomoyo_io_printf(head, "%u %s\n", domain->profile, |
| 1548 | domain->domainname->name)) { | 1544 | domain->domainname->name); |
| 1549 | done = false; | 1545 | if (!done) |
| 1550 | break; | 1546 | break; |
| 1551 | } | ||
| 1552 | } | 1547 | } |
| 1553 | up_read(&tomoyo_domain_list_lock); | 1548 | up_read(&tomoyo_domain_list_lock); |
| 1554 | head->read_eof = done; | 1549 | head->read_eof = done; |
diff --git a/security/tomoyo/domain.c b/security/tomoyo/domain.c index aa119ca5a78..34bb641c674 100644 --- a/security/tomoyo/domain.c +++ b/security/tomoyo/domain.c | |||
| @@ -189,13 +189,12 @@ bool tomoyo_read_domain_initializer_policy(struct tomoyo_io_buffer *head) | |||
| 189 | from = " from "; | 189 | from = " from "; |
| 190 | domain = ptr->domainname->name; | 190 | domain = ptr->domainname->name; |
| 191 | } | 191 | } |
| 192 | if (!tomoyo_io_printf(head, | 192 | done = tomoyo_io_printf(head, |
| 193 | "%s" TOMOYO_KEYWORD_INITIALIZE_DOMAIN | 193 | "%s" TOMOYO_KEYWORD_INITIALIZE_DOMAIN |
| 194 | "%s%s%s\n", no, ptr->program->name, from, | 194 | "%s%s%s\n", no, ptr->program->name, |
| 195 | domain)) { | 195 | from, domain); |
| 196 | done = false; | 196 | if (!done) |
| 197 | break; | 197 | break; |
| 198 | } | ||
| 199 | } | 198 | } |
| 200 | up_read(&tomoyo_domain_initializer_list_lock); | 199 | up_read(&tomoyo_domain_initializer_list_lock); |
| 201 | return done; | 200 | return done; |
| @@ -387,13 +386,12 @@ bool tomoyo_read_domain_keeper_policy(struct tomoyo_io_buffer *head) | |||
| 387 | from = " from "; | 386 | from = " from "; |
| 388 | program = ptr->program->name; | 387 | program = ptr->program->name; |
| 389 | } | 388 | } |
| 390 | if (!tomoyo_io_printf(head, | 389 | done = tomoyo_io_printf(head, |
| 391 | "%s" TOMOYO_KEYWORD_KEEP_DOMAIN | 390 | "%s" TOMOYO_KEYWORD_KEEP_DOMAIN |
| 392 | "%s%s%s\n", no, program, from, | 391 | "%s%s%s\n", no, program, from, |
| 393 | ptr->domainname->name)) { | 392 | ptr->domainname->name); |
| 394 | done = false; | 393 | if (!done) |
| 395 | break; | 394 | break; |
| 396 | } | ||
| 397 | } | 395 | } |
| 398 | up_read(&tomoyo_domain_keeper_list_lock); | 396 | up_read(&tomoyo_domain_keeper_list_lock); |
| 399 | return done; | 397 | return done; |
| @@ -513,12 +511,11 @@ bool tomoyo_read_alias_policy(struct tomoyo_io_buffer *head) | |||
| 513 | ptr = list_entry(pos, struct tomoyo_alias_entry, list); | 511 | ptr = list_entry(pos, struct tomoyo_alias_entry, list); |
| 514 | if (ptr->is_deleted) | 512 | if (ptr->is_deleted) |
| 515 | continue; | 513 | continue; |
| 516 | if (!tomoyo_io_printf(head, TOMOYO_KEYWORD_ALIAS "%s %s\n", | 514 | done = tomoyo_io_printf(head, TOMOYO_KEYWORD_ALIAS "%s %s\n", |
| 517 | ptr->original_name->name, | 515 | ptr->original_name->name, |
| 518 | ptr->aliased_name->name)) { | 516 | ptr->aliased_name->name); |
| 519 | done = false; | 517 | if (!done) |
| 520 | break; | 518 | break; |
| 521 | } | ||
| 522 | } | 519 | } |
| 523 | up_read(&tomoyo_alias_list_lock); | 520 | up_read(&tomoyo_alias_list_lock); |
| 524 | return done; | 521 | return done; |
diff --git a/security/tomoyo/file.c b/security/tomoyo/file.c index adf786d7421..a67f9e61ee6 100644 --- a/security/tomoyo/file.c +++ b/security/tomoyo/file.c | |||
| @@ -247,11 +247,10 @@ bool tomoyo_read_globally_readable_policy(struct tomoyo_io_buffer *head) | |||
| 247 | list); | 247 | list); |
| 248 | if (ptr->is_deleted) | 248 | if (ptr->is_deleted) |
| 249 | continue; | 249 | continue; |
| 250 | if (!tomoyo_io_printf(head, TOMOYO_KEYWORD_ALLOW_READ "%s\n", | 250 | done = tomoyo_io_printf(head, TOMOYO_KEYWORD_ALLOW_READ "%s\n", |
| 251 | ptr->filename->name)) { | 251 | ptr->filename->name); |
| 252 | done = false; | 252 | if (!done) |
| 253 | break; | 253 | break; |
| 254 | } | ||
| 255 | } | 254 | } |
| 256 | up_read(&tomoyo_globally_readable_list_lock); | 255 | up_read(&tomoyo_globally_readable_list_lock); |
| 257 | return done; | 256 | return done; |
| @@ -369,11 +368,10 @@ bool tomoyo_read_file_pattern(struct tomoyo_io_buffer *head) | |||
| 369 | ptr = list_entry(pos, struct tomoyo_pattern_entry, list); | 368 | ptr = list_entry(pos, struct tomoyo_pattern_entry, list); |
| 370 | if (ptr->is_deleted) | 369 | if (ptr->is_deleted) |
| 371 | continue; | 370 | continue; |
| 372 | if (!tomoyo_io_printf(head, TOMOYO_KEYWORD_FILE_PATTERN "%s\n", | 371 | done = tomoyo_io_printf(head, TOMOYO_KEYWORD_FILE_PATTERN |
| 373 | ptr->pattern->name)) { | 372 | "%s\n", ptr->pattern->name); |
| 374 | done = false; | 373 | if (!done) |
| 375 | break; | 374 | break; |
| 376 | } | ||
| 377 | } | 375 | } |
| 378 | up_read(&tomoyo_pattern_list_lock); | 376 | up_read(&tomoyo_pattern_list_lock); |
| 379 | return done; | 377 | return done; |
| @@ -483,11 +481,10 @@ bool tomoyo_read_no_rewrite_policy(struct tomoyo_io_buffer *head) | |||
| 483 | ptr = list_entry(pos, struct tomoyo_no_rewrite_entry, list); | 481 | ptr = list_entry(pos, struct tomoyo_no_rewrite_entry, list); |
| 484 | if (ptr->is_deleted) | 482 | if (ptr->is_deleted) |
| 485 | continue; | 483 | continue; |
| 486 | if (!tomoyo_io_printf(head, TOMOYO_KEYWORD_DENY_REWRITE "%s\n", | 484 | done = tomoyo_io_printf(head, TOMOYO_KEYWORD_DENY_REWRITE |
| 487 | ptr->pattern->name)) { | 485 | "%s\n", ptr->pattern->name); |
| 488 | done = false; | 486 | if (!done) |
| 489 | break; | 487 | break; |
| 490 | } | ||
| 491 | } | 488 | } |
| 492 | up_read(&tomoyo_no_rewrite_list_lock); | 489 | up_read(&tomoyo_no_rewrite_list_lock); |
| 493 | return done; | 490 | return done; |
