mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-08 20:07:46 +09:00
net: Only NET_ADMIN is allowed to fully control TUN interfaces.
Signed-off-by: Chia-chi Yeh <chiachi@android.com>
This commit is contained in:
committed by
Colin Cross
parent
40ad8e5a3c
commit
c001b9448b
@@ -1889,6 +1889,12 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd,
|
||||
unsigned int ifindex;
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user