projects
/
GitHub
/
LineageOS
/
android_kernel_motorola_exynos9610.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
d846068
)
ANDROID: net: paranoid: Only NET_ADMIN is allowed to fully control TUN interfaces.
author
Chia-chi Yeh
<chiachi@android.com>
Fri, 15 Jul 2011 22:32:57 +0000
(15:32 -0700)
committer
Amit Pundir
<amit.pundir@linaro.org>
Mon, 18 Dec 2017 15:41:22 +0000
(21:11 +0530)
Signed-off-by: Chia-chi Yeh <chiachi@android.com>
drivers/net/tun.c
patch
|
blob
|
blame
|
history
diff --git
a/drivers/net/tun.c
b/drivers/net/tun.c
index 42bb820a56c92e812d93e66ae2e87a9e0648f001..fe3f1ad35bbefbafc407e1a76bc75b46dabddcaa 100644
(file)
--- a/
drivers/net/tun.c
+++ b/
drivers/net/tun.c
@@
-2252,6
+2252,12
@@
static long __tun_chr_ioctl(struct file *file, unsigned int cmd,
int le;
int ret;
+#ifdef CONFIG_ANDROID_PARANOID_NETWORK
+ if (cmd != TUNGETIFF && !capable(CAP_NET_ADMIN)) {
+ return -EPERM;
+ }
+#endif
+
if (cmd == TUNSETIFF || cmd == TUNSETQUEUE || _IOC_TYPE(cmd) == SOCK_IOC_TYPE) {
if (copy_from_user(&ifr, argp, ifreq_len))
return -EFAULT;