]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
apparmor: Fix failed mount permission check error message
authorJohn Johansen <john.johansen@canonical.com>
Tue, 25 Jan 2022 08:37:42 +0000 (00:37 -0800)
committerJohn Johansen <john.johansen@canonical.com>
Sat, 9 Jul 2022 22:13:59 +0000 (15:13 -0700)
When the mount check fails due to a permission check failure instead
of explicitly at one of the subcomponent checks, AppArmor is reporting
a failure in the flags match. However this is not true and AppArmor
can not attribute the error at this point to any particular component,
and should only indicate the mount failed due to missing permissions.

Fixes: 2ea3ffb7782a ("apparmor: add mount mediation")
Signed-off-by: John Johansen <john.johansen@canonical.com>
security/apparmor/mount.c

index aa6fcfde30514803dbcf8d1e0c20bc5529033c1c..23aafe68d49a956dd51484127bcb0e77c72cee3c 100644 (file)
@@ -229,7 +229,8 @@ static const char * const mnt_info_table[] = {
        "failed srcname match",
        "failed type match",
        "failed flags match",
-       "failed data match"
+       "failed data match",
+       "failed perms check"
 };
 
 /*
@@ -284,8 +285,8 @@ static int do_match_mnt(struct aa_dfa *dfa, unsigned int start,
                        return 0;
        }
 
-       /* failed at end of flags match */
-       return 4;
+       /* failed at perms check, don't confuse with flags match */
+       return 6;
 }