ANDROID: net: paranoid: security: Add proper checks for Android specific capability...
authorTushar Behera <tushar.behera@linaro.org>
Mon, 26 Mar 2012 11:24:15 +0000 (16:54 +0530)
committerAmit Pundir <amit.pundir@linaro.org>
Mon, 18 Dec 2017 15:41:22 +0000 (21:11 +0530)
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>
security/commoncap.c

index 0bf9f56af612d6f1c43e5cb8ad88154d8b01aa6b..a00862bcf429e920267385d8ba898b0409ae0206 100644 (file)
@@ -77,10 +77,12 @@ int cap_capable(const struct cred *cred, struct user_namespace *targ_ns,
 {
        struct user_namespace *ns = targ_ns;
 
+#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
 
        /* See if cred has the capability in the target user namespace
         * by examining the target user namespace and all of the target