summaryrefslogtreecommitdiff
path: root/security
diff options
context:
space:
mode:
authorTushar Behera <tushar.behera@linaro.org>2012-03-26 16:54:15 +0530
committerAnton Vorontsov <anton.vorontsov@linaro.org>2012-11-05 11:47:18 -0800
commitcd3bb5d71e6700ba937e2b59b6643904db0d4bb1 (patch)
tree442bdc762f8650241615653ed978a87597ef9ea7 /security
parent2bf219ed30fc85fad52b5a39e9510b4b93f793fc (diff)
downloadlinux-topics-cd3bb5d71e6700ba937e2b59b6643904db0d4bb1.tar.gz
security: Add proper checks for Android specific capability checks
Commit b641072 ("security: Add AID_NET_RAW and AID_NET_ADMIN capability check in cap_capable().") introduces additional checks for AID_NET_xxx macros. Since the header file including those macros are conditionally included, the checks should also be conditionally executed. Change-Id: Iaec5208d5b95a46b1ac3f2db8449c661e803fa5b Signed-off-by: Tushar Behera <tushar.behera@linaro.org> Signed-off-by: Andrey Konovalov <andrey.konovalov@linaro.org>
Diffstat (limited to 'security')
-rw-r--r--security/commoncap.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/security/commoncap.c b/security/commoncap.c
index 8cb5a55ad32..8b431e4e591 100644
--- a/security/commoncap.c
+++ b/security/commoncap.c
@@ -80,10 +80,12 @@ int cap_netlink_send(struct sock *sk, struct sk_buff *skb)
int cap_capable(const struct cred *cred, struct user_namespace *targ_ns,
int cap, int audit)
{
+#ifdef CONFIG_ANDROID_PARANOID_NETWORK
if (cap == CAP_NET_RAW && in_egroup_p(AID_NET_RAW))
return 0;
if (cap == CAP_NET_ADMIN && in_egroup_p(AID_NET_ADMIN))
return 0;
+#endif
for (;;) {
/* The owner of the user namespace has all caps. */