diff options
Diffstat (limited to 'net/netlabel/netlabel_unlabeled.c')
-rw-r--r-- | net/netlabel/netlabel_unlabeled.c | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/net/netlabel/netlabel_unlabeled.c b/net/netlabel/netlabel_unlabeled.c index 90c8506a0aac..8c0308032178 100644 --- a/net/netlabel/netlabel_unlabeled.c +++ b/net/netlabel/netlabel_unlabeled.c | |||
@@ -562,7 +562,6 @@ static int netlbl_unlhsh_remove_addr4(struct net *net, | |||
562 | const struct in_addr *mask, | 562 | const struct in_addr *mask, |
563 | struct netlbl_audit *audit_info) | 563 | struct netlbl_audit *audit_info) |
564 | { | 564 | { |
565 | int ret_val = 0; | ||
566 | struct netlbl_af4list *list_entry; | 565 | struct netlbl_af4list *list_entry; |
567 | struct netlbl_unlhsh_addr4 *entry; | 566 | struct netlbl_unlhsh_addr4 *entry; |
568 | struct audit_buffer *audit_buf; | 567 | struct audit_buffer *audit_buf; |
@@ -577,7 +576,7 @@ static int netlbl_unlhsh_remove_addr4(struct net *net, | |||
577 | if (list_entry != NULL) | 576 | if (list_entry != NULL) |
578 | entry = netlbl_unlhsh_addr4_entry(list_entry); | 577 | entry = netlbl_unlhsh_addr4_entry(list_entry); |
579 | else | 578 | else |
580 | ret_val = -ENOENT; | 579 | entry = NULL; |
581 | 580 | ||
582 | audit_buf = netlbl_audit_start_common(AUDIT_MAC_UNLBL_STCDEL, | 581 | audit_buf = netlbl_audit_start_common(AUDIT_MAC_UNLBL_STCDEL, |
583 | audit_info); | 582 | audit_info); |
@@ -588,19 +587,21 @@ static int netlbl_unlhsh_remove_addr4(struct net *net, | |||
588 | addr->s_addr, mask->s_addr); | 587 | addr->s_addr, mask->s_addr); |
589 | if (dev != NULL) | 588 | if (dev != NULL) |
590 | dev_put(dev); | 589 | dev_put(dev); |
591 | if (entry && security_secid_to_secctx(entry->secid, | 590 | if (entry != NULL && |
592 | &secctx, | 591 | security_secid_to_secctx(entry->secid, |
593 | &secctx_len) == 0) { | 592 | &secctx, &secctx_len) == 0) { |
594 | audit_log_format(audit_buf, " sec_obj=%s", secctx); | 593 | audit_log_format(audit_buf, " sec_obj=%s", secctx); |
595 | security_release_secctx(secctx, secctx_len); | 594 | security_release_secctx(secctx, secctx_len); |
596 | } | 595 | } |
597 | audit_log_format(audit_buf, " res=%u", ret_val == 0 ? 1 : 0); | 596 | audit_log_format(audit_buf, " res=%u", entry != NULL ? 1 : 0); |
598 | audit_log_end(audit_buf); | 597 | audit_log_end(audit_buf); |
599 | } | 598 | } |
600 | 599 | ||
601 | if (ret_val == 0) | 600 | if (entry == NULL) |
602 | call_rcu(&entry->rcu, netlbl_unlhsh_free_addr4); | 601 | return -ENOENT; |
603 | return ret_val; | 602 | |
603 | call_rcu(&entry->rcu, netlbl_unlhsh_free_addr4); | ||
604 | return 0; | ||
604 | } | 605 | } |
605 | 606 | ||
606 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | 607 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) |
@@ -624,7 +625,6 @@ static int netlbl_unlhsh_remove_addr6(struct net *net, | |||
624 | const struct in6_addr *mask, | 625 | const struct in6_addr *mask, |
625 | struct netlbl_audit *audit_info) | 626 | struct netlbl_audit *audit_info) |
626 | { | 627 | { |
627 | int ret_val = 0; | ||
628 | struct netlbl_af6list *list_entry; | 628 | struct netlbl_af6list *list_entry; |
629 | struct netlbl_unlhsh_addr6 *entry; | 629 | struct netlbl_unlhsh_addr6 *entry; |
630 | struct audit_buffer *audit_buf; | 630 | struct audit_buffer *audit_buf; |
@@ -638,7 +638,7 @@ static int netlbl_unlhsh_remove_addr6(struct net *net, | |||
638 | if (list_entry != NULL) | 638 | if (list_entry != NULL) |
639 | entry = netlbl_unlhsh_addr6_entry(list_entry); | 639 | entry = netlbl_unlhsh_addr6_entry(list_entry); |
640 | else | 640 | else |
641 | ret_val = -ENOENT; | 641 | entry = NULL; |
642 | 642 | ||
643 | audit_buf = netlbl_audit_start_common(AUDIT_MAC_UNLBL_STCDEL, | 643 | audit_buf = netlbl_audit_start_common(AUDIT_MAC_UNLBL_STCDEL, |
644 | audit_info); | 644 | audit_info); |
@@ -649,19 +649,21 @@ static int netlbl_unlhsh_remove_addr6(struct net *net, | |||
649 | addr, mask); | 649 | addr, mask); |
650 | if (dev != NULL) | 650 | if (dev != NULL) |
651 | dev_put(dev); | 651 | dev_put(dev); |
652 | if (entry && security_secid_to_secctx(entry->secid, | 652 | if (entry != NULL && |
653 | &secctx, | 653 | security_secid_to_secctx(entry->secid, |
654 | &secctx_len) == 0) { | 654 | &secctx, &secctx_len) == 0) { |
655 | audit_log_format(audit_buf, " sec_obj=%s", secctx); | 655 | audit_log_format(audit_buf, " sec_obj=%s", secctx); |
656 | security_release_secctx(secctx, secctx_len); | 656 | security_release_secctx(secctx, secctx_len); |
657 | } | 657 | } |
658 | audit_log_format(audit_buf, " res=%u", ret_val == 0 ? 1 : 0); | 658 | audit_log_format(audit_buf, " res=%u", entry != NULL ? 1 : 0); |
659 | audit_log_end(audit_buf); | 659 | audit_log_end(audit_buf); |
660 | } | 660 | } |
661 | 661 | ||
662 | if (ret_val == 0) | 662 | if (entry == NULL) |
663 | call_rcu(&entry->rcu, netlbl_unlhsh_free_addr6); | 663 | return -ENOENT; |
664 | return ret_val; | 664 | |
665 | call_rcu(&entry->rcu, netlbl_unlhsh_free_addr6); | ||
666 | return 0; | ||
665 | } | 667 | } |
666 | #endif /* IPv6 */ | 668 | #endif /* IPv6 */ |
667 | 669 | ||