diff options
author | Ingo Molnar <mingo@kernel.org> | 2017-11-07 10:32:44 +0100 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2017-11-07 10:32:44 +0100 |
commit | 8c5db92a705d9e2c986adec475980d1120fa07b4 (patch) | |
tree | 9f0eea56889819707c0a1a8eb5b1fb2db3cdaf3d /drivers/net/tun.c | |
parent | ca5d376e17072c1b60c3fee66f3be58ef018952d (diff) | |
parent | e4880bc5dfb1f02b152e62a894b5c6f3e995b3cf (diff) | |
download | linux-8c5db92a705d9e2c986adec475980d1120fa07b4.tar.bz2 |
Merge branch 'linus' into locking/core, to resolve conflicts
Conflicts:
include/linux/compiler-clang.h
include/linux/compiler-gcc.h
include/linux/compiler-intel.h
include/uapi/linux/stddef.h
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'drivers/net/tun.c')
-rw-r--r-- | drivers/net/tun.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/net/tun.c b/drivers/net/tun.c index 27cd50c5bc9e..c1685a6d7883 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c @@ -1286,6 +1286,7 @@ static struct sk_buff *tun_build_skb(struct tun_struct *tun, buflen += SKB_DATA_ALIGN(len + pad); rcu_read_unlock(); + alloc_frag->offset = ALIGN((u64)alloc_frag->offset, SMP_CACHE_BYTES); if (unlikely(!skb_page_frag_refill(buflen, alloc_frag, GFP_KERNEL))) return ERR_PTR(-ENOMEM); @@ -2028,7 +2029,7 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) if (!dev) return -ENOMEM; err = dev_get_valid_name(net, dev, name); - if (err) + if (err < 0) goto err_free_dev; dev_net_set(dev, net); @@ -2428,6 +2429,10 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd, ret = -EFAULT; break; } + if (sndbuf <= 0) { + ret = -EINVAL; + break; + } tun->sndbuf = sndbuf; tun_set_sndbuf(tun); |