projects
/
firefly-linux-kernel-4.4.55.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
adce689
)
net: 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
Chia-chi Yeh
<chiachi@android.com>
Sat, 16 Jul 2011 00:06:10 +0000
(17:06 -0700)
Signed-off-by: Chia-chi Yeh <chiachi@android.com>
drivers/net/tun.c
patch
|
blob
|
history
diff --git
a/drivers/net/tun.c
b/drivers/net/tun.c
index 5235f48be1be677b7ca57fd275c21392fb846762..67e474ff1a91c2c55b3167f37545c1aef38dffdc 100644
(file)
--- a/
drivers/net/tun.c
+++ b/
drivers/net/tun.c
@@
-1238,6
+1238,12
@@
static long __tun_chr_ioctl(struct file *file, unsigned int cmd,
int vnet_hdr_sz;
int ret;
+#ifdef CONFIG_ANDROID_PARANOID_NETWORK
+ if (cmd != TUNGETIFF && !capable(CAP_NET_ADMIN)) {
+ return -EPERM;
+ }
+#endif
+
if (cmd == TUNSETIFF || _IOC_TYPE(cmd) == 0x89)
if (copy_from_user(&ifr, argp, ifreq_len))
return -EFAULT;