]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
UBUNTU: SAUCE: apparmor: fix vec_unique for vectors larger than 8
authorJohn Johansen <john.johansen@canonical.com>
Mon, 22 Aug 2016 21:14:48 +0000 (14:14 -0700)
committerTim Gardner <tim.gardner@canonical.com>
Mon, 20 Feb 2017 03:57:58 +0000 (20:57 -0700)
the vec_unique path for large vectors is broken, leading to oopses
when a file handle is shared between 8 different security domains, and
then a profile replacement/removal causing a label invalidation (ie. not
all replacements) is done.

BugLink: http://bugs.launchpad.net/bugs/1579135
Signed-off-by: John Johansen <john.johansen@canonical.com>
Signed-off-by: Leann Ogasawara <leann.ogasawara@canonical.com>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
security/apparmor/label.c

index 144d759c859710d0573f9f3a24665a88b70e4f9f..c11ca99af8e1ca089fa4813f57bbda9605b706e2 100644 (file)
@@ -229,7 +229,7 @@ static inline int unique(struct aa_profile **vec, int n)
        AA_BUG(!vec);
 
        pos = 0;
-       for (i = 1; 1 < n; i++) {
+       for (i = 1; i < n; i++) {
                int res = profile_cmp(vec[pos], vec[i]);
                AA_BUG(res > 0, "vec not sorted");
                if (res == 0) {