Skip to contentSkip to conversation

selinux: fix a capabilities parsing typo in selinux_bpf_token_capable()

PATCH Applied Paul Moore 1 participant 2 messages Jan 14 – Jan 15 SELinux security module

lore
Share & tools
lore

Paul Moore

author maintainer
#0 lore raw

PATCH 1/1 selinux: fix a capabilities parsing typo in selinux_bpf_token_capable()

There was a typo, likely a cut-n-paste bug, where we were checking for SECCLASS_CAPABILITY instead of SECCLASS_CAPABILITY2.

Fixes 5473a722f782 ("selinux: add support for BPF token access control")
---
 security/selinux/hooks.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
security/selinux/hooks.c +1 -1
index c7c19ceeeb2f..9289ed89a8ec 100644
@@ -7260,7 +7260,7 @@ static int selinux_bpf_token_capable(const struct bpf_token *token, int cap)
 		sclass = initns ? SECCLASS_CAPABILITY : SECCLASS_CAP_USERNS;
 		break;
 	case 1:
-		sclass = initns ? SECCLASS_CAPABILITY : SECCLASS_CAP2_USERNS;
+		sclass = initns ? SECCLASS_CAPABILITY2 : SECCLASS_CAP2_USERNS;
 		break;
 	default:
 		pr_err("SELinux:  out of range capability %d\n", cap);
Signature · 1 line
2.52.0
author maintainer Applied
#1 lore raw
Quoted 10 lines · Paul Moore

There was a typo, likely a cut-n-paste bug, where we were checking for SECCLASS_CAPABILITY instead of SECCLASS_CAPABILITY2.

Fixes 5473a722f782 ("selinux: add support for BPF token access control")
---
 security/selinux/hooks.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Merged into selinux/dev.

Signature · 1 line
paul-moore.com