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:
cc04396
)
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
John Stultz
<john.stultz@linaro.org>
Tue, 16 Feb 2016 21:51:14 +0000
(13:51 -0800)
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 f0db770e8b2f9655be8d3c3000a9395f945284e2..2228a539184a00b1f4f5a32dafe794616fefdacc 100644
(file)
--- a/
drivers/net/tun.c
+++ b/
drivers/net/tun.c
@@
-1886,6
+1886,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) == 0x89) {
if (copy_from_user(&ifr, argp, ifreq_len))
return -EFAULT;