apparmor: Fix incorrect profile->signal range check
Subsystems (3)
PATCH 1/1 apparmor: Fix incorrect profile->signal range check
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 <[email protected]>
--- security/apparmor/policy_unpack.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
security/apparmor/policy_unpack.c +1 -1
@@ -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.49.0
Quoted 25 lines · Colin Ian King
The check on
profile->signalis always false, the value can never be less than 1 *and* greater thanMAXMAPPED_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 <[email protected]>--- security/apparmor/policy_unpack.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)security/apparmor/policy_unpack.c +1
-2@@ -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; } --
Quoted 1 line
2.49.0
Reviewed-by Ryan Lee <[email protected]>
Quoted 2 lines
Quoted 18 lines · Ryan Lee
Quoted 17 lines · Colin Ian King
The check on
profile->signalis always false, the value can never be less than 1 *and* greater thanMAXMAPPED_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 <[email protected]>--- security/apparmor/policy_unpack.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)security/apparmor/policy_unpack.c +0
-0@@ -919,7 +919,7 @@ static struct aa_profile *unpack_profile(struct aa_ext *e, char **ns_name)
Quoted 11 lines
Quoted 9 lines
security/apparmor/policy_unpack.c +1
-2/* 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; } --2.49.0
Reviewed-by Ryan Lee <[email protected]>
Acked-by John Johansen <[email protected]>
I have pulled this into my tree