Skip to contentSkip to conversation

security: remove duplicate logical judgments in return

PATCH NAK Minjie Du 2 participants 2 messages Jul 4, 2023 – Jul 5, 2023

Subsystems (2)
lore
Share & tools
lore

Minjie Du

author
#0 lore raw

PATCH 1/1 security: remove duplicate logical judgments in return

Fix: delate duplicate logical judgments:
aa_unpack_u32(e, &perm->allow, NULL);
Please check this. Thank you!

---
 security/apparmor/policy_unpack.c | 1 -
 1 file changed, 1 deletion(-)
security/apparmor/policy_unpack.c +0 -1
index 694fb7a09..2069adf0a 100644
@@ -646,7 +646,6 @@ static bool unpack_perm(struct aa_ext *e, u32 version, struct aa_perms *perm)
 		return false;
 
 	return	aa_unpack_u32(e, &perm->allow, NULL) &&
-		aa_unpack_u32(e, &perm->allow, NULL) &&
 		aa_unpack_u32(e, &perm->deny, NULL) &&
 		aa_unpack_u32(e, &perm->subtree, NULL) &&
 		aa_unpack_u32(e, &perm->cond, NULL) &&
Signature · 1 line
2.39.0
maintainer NAK
#1 lore raw
Quoted 5 lines · Minjie Du

Fix: delate duplicate logical judgments:
aa_unpack_u32(e, &perm->allow, NULL);
Please check this. Thank you!

NAK, it is a bug but not in a way that we can do this, which will break the unpack. The first entry is reserved, and for the moment should be skipped. Double loading to &perm->allow, effectively does that but was not what was intended either. There is a patch coming that loads the first entry to a tmp variable and does a check that it is 0.

Quoted 16 lines
---
  security/apparmor/policy_unpack.c | 1 -
  1 file changed, 1 deletion(-)
security/apparmor/policy_unpack.c +0 -1
index 694fb7a09..2069adf0a 100644
@@ -646,7 +646,6 @@ static bool unpack_perm(struct aa_ext *e, u32 version, struct aa_perms *perm)
  		return false;
 
  	return	aa_unpack_u32(e, &perm->allow, NULL) &&
-		aa_unpack_u32(e, &perm->allow, NULL) &&
  		aa_unpack_u32(e, &perm->deny, NULL) &&
  		aa_unpack_u32(e, &perm->subtree, NULL) &&
  		aa_unpack_u32(e, &perm->cond, NULL) &&