]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
apparmor: Fix incorrect profile->signal range check
authorColin Ian King <colin.i.king@gmail.com>
Sat, 17 May 2025 08:49:20 +0000 (01:49 -0700)
committerJohn Johansen <john.johansen@canonical.com>
Sat, 17 May 2025 08:49:20 +0000 (01:49 -0700)
The check on profile->signal is always false, the value can never be
less than 1 *and* greater than MAXMAPPED_SIG. Fix this by replacing
the logical operator && with ||.

Fixes: 84c455decf27 ("apparmor: add support for profiles to define the kill signal")
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Signed-off-by: John Johansen <john.johansen@canonical.com>
security/apparmor/policy_unpack.c

index 459eb878c824663c46f83deee3d1a195e6e88329..588dd1d5d36454c4ada1152f602952da8ca54148 100644 (file)
@@ -919,7 +919,7 @@ static struct aa_profile *unpack_profile(struct aa_ext *e, char **ns_name)
 
        /* optional */
        (void) aa_unpack_u32(e, &profile->signal, "kill");
-       if (profile->signal < 1 && profile->signal > MAXMAPPED_SIG) {
+       if (profile->signal < 1 || profile->signal > MAXMAPPED_SIG) {
                info = "profile kill.signal invalid value";
                goto fail;
        }