X-Git-Url: https://git.openpandora.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=drivers%2Fnet%2Ftun.c;h=55dc70c6b4db093cc5c021bdd722cf59b4873888;hb=86a264abe542cfececb4df129bc45a0338d8cdb9;hp=33b6d1b122fb59fdadfdd2f156a0596f37efcc25;hpb=20ebc0073b0fb63ce4a27ca761418ecfdecaadb7;p=pandora-kernel.git diff --git a/drivers/net/tun.c b/drivers/net/tun.c index 33b6d1b122fb..55dc70c6b4db 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c @@ -702,6 +702,7 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) struct tun_net *tn; struct tun_struct *tun; struct net_device *dev; + const struct cred *cred = current_cred(); int err; tn = net_generic(net, tun_net_id); @@ -712,11 +713,12 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) /* Check permissions */ if (((tun->owner != -1 && - current->euid != tun->owner) || + cred->euid != tun->owner) || (tun->group != -1 && - current->egid != tun->group)) && - !capable(CAP_NET_ADMIN)) + cred->egid != tun->group)) && + !capable(CAP_NET_ADMIN)) { return -EPERM; + } } else if (__dev_get_by_name(net, ifr->ifr_name)) return -EINVAL;