diff options
author | Daniel Vetter <daniel.vetter@ffwll.ch> | 2017-02-26 15:34:42 -0500 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2017-02-26 15:34:42 -0500 |
commit | 8e22e1b3499a446df48c2b26667ca36c55bf864c (patch) | |
tree | 5329f98b3eb3c95a9dcbab0fa4f9b6e62f0e788d /drivers/net/tun.c | |
parent | 00d3c14f14d51babd8aeafd5fa734ccf04f5ca3d (diff) | |
parent | 64a577196d66b44e37384bc5c4d78c61f59d5b2a (diff) |
Merge airlied/drm-next into drm-misc-next
Backmerge the main pull request to sync up with all the newly landed
drivers. Otherwise we'll have chaos even before 4.12 started in
earnest.
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Diffstat (limited to 'drivers/net/tun.c')
-rw-r--r-- | drivers/net/tun.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/net/tun.c b/drivers/net/tun.c index cd8e02c94be0..bfabe180053e 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c | |||
@@ -1170,9 +1170,11 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile, | |||
1170 | } | 1170 | } |
1171 | 1171 | ||
1172 | if (tun->flags & IFF_VNET_HDR) { | 1172 | if (tun->flags & IFF_VNET_HDR) { |
1173 | if (len < tun->vnet_hdr_sz) | 1173 | int vnet_hdr_sz = READ_ONCE(tun->vnet_hdr_sz); |
1174 | |||
1175 | if (len < vnet_hdr_sz) | ||
1174 | return -EINVAL; | 1176 | return -EINVAL; |
1175 | len -= tun->vnet_hdr_sz; | 1177 | len -= vnet_hdr_sz; |
1176 | 1178 | ||
1177 | if (!copy_from_iter_full(&gso, sizeof(gso), from)) | 1179 | if (!copy_from_iter_full(&gso, sizeof(gso), from)) |
1178 | return -EFAULT; | 1180 | return -EFAULT; |
@@ -1183,7 +1185,7 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile, | |||
1183 | 1185 | ||
1184 | if (tun16_to_cpu(tun, gso.hdr_len) > len) | 1186 | if (tun16_to_cpu(tun, gso.hdr_len) > len) |
1185 | return -EINVAL; | 1187 | return -EINVAL; |
1186 | iov_iter_advance(from, tun->vnet_hdr_sz - sizeof(gso)); | 1188 | iov_iter_advance(from, vnet_hdr_sz - sizeof(gso)); |
1187 | } | 1189 | } |
1188 | 1190 | ||
1189 | if ((tun->flags & TUN_TYPE_MASK) == IFF_TAP) { | 1191 | if ((tun->flags & TUN_TYPE_MASK) == IFF_TAP) { |
@@ -1335,7 +1337,7 @@ static ssize_t tun_put_user(struct tun_struct *tun, | |||
1335 | vlan_hlen = VLAN_HLEN; | 1337 | vlan_hlen = VLAN_HLEN; |
1336 | 1338 | ||
1337 | if (tun->flags & IFF_VNET_HDR) | 1339 | if (tun->flags & IFF_VNET_HDR) |
1338 | vnet_hdr_sz = tun->vnet_hdr_sz; | 1340 | vnet_hdr_sz = READ_ONCE(tun->vnet_hdr_sz); |
1339 | 1341 | ||
1340 | total = skb->len + vlan_hlen + vnet_hdr_sz; | 1342 | total = skb->len + vlan_hlen + vnet_hdr_sz; |
1341 | 1343 | ||
@@ -1360,7 +1362,7 @@ static ssize_t tun_put_user(struct tun_struct *tun, | |||
1360 | return -EINVAL; | 1362 | return -EINVAL; |
1361 | 1363 | ||
1362 | if (virtio_net_hdr_from_skb(skb, &gso, | 1364 | if (virtio_net_hdr_from_skb(skb, &gso, |
1363 | tun_is_little_endian(tun))) { | 1365 | tun_is_little_endian(tun), true)) { |
1364 | struct skb_shared_info *sinfo = skb_shinfo(skb); | 1366 | struct skb_shared_info *sinfo = skb_shinfo(skb); |
1365 | pr_err("unexpected GSO type: " | 1367 | pr_err("unexpected GSO type: " |
1366 | "0x%x, gso_size %d, hdr_len %d\n", | 1368 | "0x%x, gso_size %d, hdr_len %d\n", |