ANDROID: net: paranoid: Only NET_ADMIN is allowed to fully control TUN interfaces.
Signed-off-by: Chia-chi Yeh <chiachi@android.com>
This commit is contained in:
parent
336442ab5c
commit
6ac0eb6d0d
1 changed files with 6 additions and 0 deletions
|
@ -2879,6 +2879,12 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd,
|
|||
int ret;
|
||||
bool do_notify = false;
|
||||
|
||||
#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 && cmd != SIOCGSKNS)) {
|
||||
if (copy_from_user(&ifr, argp, ifreq_len))
|
||||
|
|
Loading…
Reference in a new issue