aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/tun.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2013-08-16 18:37:26 -0400
committerDavid S. Miller <davem@davemloft.net>2013-08-16 18:37:26 -0400
commit2ff1cf12c9fe70e75e600404e6a4274b19d293ed (patch)
treebeafddac0a8098e3f07d2ec60e44a2a7d006e605 /drivers/net/tun.c
parent16b304f3404f8e0243d5ee2b70b68767b7b59b2b (diff)
parent0f7dd1aa8f959216f1faa71513b9d3c1a9065e5a (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Diffstat (limited to 'drivers/net/tun.c')
-rw-r--r--drivers/net/tun.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 978d8654b14a..7ed13cc0dcb2 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -977,8 +977,9 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile,
977 u32 rxhash; 977 u32 rxhash;
978 978
979 if (!(tun->flags & TUN_NO_PI)) { 979 if (!(tun->flags & TUN_NO_PI)) {
980 if ((len -= sizeof(pi)) > total_len) 980 if (len < sizeof(pi))
981 return -EINVAL; 981 return -EINVAL;
982 len -= sizeof(pi);
982 983
983 if (memcpy_fromiovecend((void *)&pi, iv, 0, sizeof(pi))) 984 if (memcpy_fromiovecend((void *)&pi, iv, 0, sizeof(pi)))
984 return -EFAULT; 985 return -EFAULT;
@@ -986,8 +987,9 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile,
986 } 987 }
987 988
988 if (tun->flags & TUN_VNET_HDR) { 989 if (tun->flags & TUN_VNET_HDR) {
989 if ((len -= tun->vnet_hdr_sz) > total_len) 990 if (len < tun->vnet_hdr_sz)
990 return -EINVAL; 991 return -EINVAL;
992 len -= tun->vnet_hdr_sz;
991 993
992 if (memcpy_fromiovecend((void *)&gso, iv, offset, sizeof(gso))) 994 if (memcpy_fromiovecend((void *)&gso, iv, offset, sizeof(gso)))
993 return -EFAULT; 995 return -EFAULT;