apparmor: Fix logical error in verify_header()
authorChristos Gkekas <chris.gekas@gmail.com>
Sat, 8 Jul 2017 19:50:21 +0000 (20:50 +0100)
committerJohn Johansen <john.johansen@canonical.com>
Fri, 22 Sep 2017 20:00:57 +0000 (13:00 -0700)
verify_header() is currently checking whether interface version is less
than 5 *and* greater than 7, which always evaluates to false. Instead it
should check whether it is less than 5 *or* greater than 7.

Signed-off-by: Christos Gkekas <chris.gekas@gmail.com>
Signed-off-by: John Johansen <john.johansen@canonical.com>
security/apparmor/policy_unpack.c

index 2d5a1a0..bda0dce 100644 (file)
@@ -832,7 +832,7 @@ static int verify_header(struct aa_ext *e, int required, const char **ns)
         * if not specified use previous version
         * Mask off everything that is not kernel abi version
         */
-       if (VERSION_LT(e->version, v5) && VERSION_GT(e->version, v7)) {
+       if (VERSION_LT(e->version, v5) || VERSION_GT(e->version, v7)) {
                audit_iface(NULL, NULL, NULL, "unsupported interface version",
                            e, error);
                return error;