diff options
Diffstat (limited to 'drivers/net/tun.c')
-rw-r--r-- | drivers/net/tun.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/net/tun.c b/drivers/net/tun.c index f042b0373e5d..bfa9bb48e42d 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c | |||
@@ -352,7 +352,7 @@ static u16 tun_select_queue(struct net_device *dev, struct sk_buff *skb) | |||
352 | u32 numqueues = 0; | 352 | u32 numqueues = 0; |
353 | 353 | ||
354 | rcu_read_lock(); | 354 | rcu_read_lock(); |
355 | numqueues = tun->numqueues; | 355 | numqueues = ACCESS_ONCE(tun->numqueues); |
356 | 356 | ||
357 | txq = skb_get_rxhash(skb); | 357 | txq = skb_get_rxhash(skb); |
358 | if (txq) { | 358 | if (txq) { |
@@ -1585,6 +1585,10 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) | |||
1585 | else | 1585 | else |
1586 | return -EINVAL; | 1586 | return -EINVAL; |
1587 | 1587 | ||
1588 | if (!!(ifr->ifr_flags & IFF_MULTI_QUEUE) != | ||
1589 | !!(tun->flags & TUN_TAP_MQ)) | ||
1590 | return -EINVAL; | ||
1591 | |||
1588 | if (tun_not_capable(tun)) | 1592 | if (tun_not_capable(tun)) |
1589 | return -EPERM; | 1593 | return -EPERM; |
1590 | err = security_tun_dev_open(tun->security); | 1594 | err = security_tun_dev_open(tun->security); |
@@ -2155,6 +2159,8 @@ static int tun_chr_open(struct inode *inode, struct file * file) | |||
2155 | set_bit(SOCK_EXTERNALLY_ALLOCATED, &tfile->socket.flags); | 2159 | set_bit(SOCK_EXTERNALLY_ALLOCATED, &tfile->socket.flags); |
2156 | INIT_LIST_HEAD(&tfile->next); | 2160 | INIT_LIST_HEAD(&tfile->next); |
2157 | 2161 | ||
2162 | sock_set_flag(&tfile->sk, SOCK_ZEROCOPY); | ||
2163 | |||
2158 | return 0; | 2164 | return 0; |
2159 | } | 2165 | } |
2160 | 2166 | ||