Skip to contentSkip to conversation

apparmor: fix logical error in signal range validation

PATCH New Dheeraj Reddy Jonnalagadda 1 participant 1 message Jan 21, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 apparmor: fix logical error in signal range validation

Fix logically impossible condition in unpack_profile() that made the signal validation code unreachable. The function was using && instead of || when checking if the signal value is outside the valid range, making it impossible for both conditions to be true simultaneously.

Update the condition to ensure proper range validation.

Fixes 84c455decf27 ("apparmor: add support for profiles to define the kill signal")
---
 security/apparmor/policy_unpack.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
security/apparmor/policy_unpack.c +1 -1
index 73139189df0f..e643514a3d92 100644
@@ -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;
 	}
Signature · 1 line
2.34.1