diff options
author | John Johansen <john.johansen@canonical.com> | 2017-08-06 08:36:40 -0400 |
---|---|---|
committer | John Johansen <john.johansen@canonical.com> | 2017-09-22 16:00:57 -0400 |
commit | f872af75d325cc449b6621a0d30a4f2ba77dd092 (patch) | |
tree | 9598997dcf0291483490e458342bb70ff8171c64 | |
parent | 2ea3ffb7782a84da33a8382f13ebd016da50079b (diff) |
apparmor: cleanup conditional check for label in label_print
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
-rw-r--r-- | security/apparmor/label.c | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/security/apparmor/label.c b/security/apparmor/label.c index e324f4df3e34..38be7a89cc31 100644 --- a/security/apparmor/label.c +++ b/security/apparmor/label.c | |||
@@ -1450,9 +1450,11 @@ bool aa_update_label_name(struct aa_ns *ns, struct aa_label *label, gfp_t gfp) | |||
1450 | * cached label name is present and visible | 1450 | * cached label name is present and visible |
1451 | * @label->hname only exists if label is namespace hierachical | 1451 | * @label->hname only exists if label is namespace hierachical |
1452 | */ | 1452 | */ |
1453 | static inline bool use_label_hname(struct aa_ns *ns, struct aa_label *label) | 1453 | static inline bool use_label_hname(struct aa_ns *ns, struct aa_label *label, |
1454 | int flags) | ||
1454 | { | 1455 | { |
1455 | if (label->hname && labels_ns(label) == ns) | 1456 | if (label->hname && (!ns || labels_ns(label) == ns) && |
1457 | !(flags & ~FLAG_SHOW_MODE)) | ||
1456 | return true; | 1458 | return true; |
1457 | 1459 | ||
1458 | return false; | 1460 | return false; |
@@ -1710,10 +1712,8 @@ void aa_label_xaudit(struct audit_buffer *ab, struct aa_ns *ns, | |||
1710 | AA_BUG(!ab); | 1712 | AA_BUG(!ab); |
1711 | AA_BUG(!label); | 1713 | AA_BUG(!label); |
1712 | 1714 | ||
1713 | if (!ns) | 1715 | if (!use_label_hname(ns, label, flags) || |
1714 | ns = labels_ns(label); | 1716 | display_mode(ns, label, flags)) { |
1715 | |||
1716 | if (!use_label_hname(ns, label) || display_mode(ns, label, flags)) { | ||
1717 | len = aa_label_asxprint(&name, ns, label, flags, gfp); | 1717 | len = aa_label_asxprint(&name, ns, label, flags, gfp); |
1718 | if (len == -1) { | 1718 | if (len == -1) { |
1719 | AA_DEBUG("label print error"); | 1719 | AA_DEBUG("label print error"); |
@@ -1738,10 +1738,7 @@ void aa_label_seq_xprint(struct seq_file *f, struct aa_ns *ns, | |||
1738 | AA_BUG(!f); | 1738 | AA_BUG(!f); |
1739 | AA_BUG(!label); | 1739 | AA_BUG(!label); |
1740 | 1740 | ||
1741 | if (!ns) | 1741 | if (!use_label_hname(ns, label, flags)) { |
1742 | ns = labels_ns(label); | ||
1743 | |||
1744 | if (!use_label_hname(ns, label)) { | ||
1745 | char *str; | 1742 | char *str; |
1746 | int len; | 1743 | int len; |
1747 | 1744 | ||
@@ -1764,10 +1761,7 @@ void aa_label_xprintk(struct aa_ns *ns, struct aa_label *label, int flags, | |||
1764 | { | 1761 | { |
1765 | AA_BUG(!label); | 1762 | AA_BUG(!label); |
1766 | 1763 | ||
1767 | if (!ns) | 1764 | if (!use_label_hname(ns, label, flags)) { |
1768 | ns = labels_ns(label); | ||
1769 | |||
1770 | if (!use_label_hname(ns, label)) { | ||
1771 | char *str; | 1765 | char *str; |
1772 | int len; | 1766 | int len; |
1773 | 1767 | ||