diff options
author | John Johansen <john.johansen@canonical.com> | 2018-06-05 04:44:59 +0200 |
---|---|---|
committer | John Johansen <john.johansen@canonical.com> | 2018-06-07 10:50:49 +0200 |
commit | a4c3f89c9b5a9fab5a8e4ea05399acd6e23072df (patch) | |
tree | 7a92b037adce16071b0ca0207115b7d8f434c5c6 /security/apparmor/label.c | |
parent | apparmor: Use an IDR to allocate apparmor secids (diff) | |
download | linux-a4c3f89c9b5a9fab5a8e4ea05399acd6e23072df.tar.xz linux-a4c3f89c9b5a9fab5a8e4ea05399acd6e23072df.zip |
apparmor: fixup secid map conversion to using IDR
The IDR conversion did not handle an error case for when allocating a
mapping fails, and it did not ensure that mappings did not allocate or
use a 0 value, which is used as an invalid secid. Which is used when a
mapping fails.
Fixes: 3ae7eb49a2be ("apparmor: Use an IDR to allocate apparmor secids")
Signed-off-by: John Johansen <john.johansen@canonical.com>
Diffstat (limited to 'security/apparmor/label.c')
-rw-r--r-- | security/apparmor/label.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/security/apparmor/label.c b/security/apparmor/label.c index a17574df611b..ba11bdf9043a 100644 --- a/security/apparmor/label.c +++ b/security/apparmor/label.c @@ -407,8 +407,7 @@ bool aa_label_init(struct aa_label *label, int size, gfp_t gfp) AA_BUG(!label); AA_BUG(size < 1); - label->secid = aa_alloc_secid(label, gfp); - if (label->secid == AA_SECID_INVALID) + if (aa_alloc_secid(label, gfp) < 0) return false; label->size = size; /* doesn't include null */ |