|
@@ -1254,6 +1254,13 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile,
|
|
return -EFAULT;
|
|
return -EFAULT;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ err = virtio_net_hdr_to_skb(skb, &gso, tun_is_little_endian(tun));
|
|
|
|
+ if (err) {
|
|
|
|
+ this_cpu_inc(tun->pcpu_stats->rx_frame_errors);
|
|
|
|
+ kfree_skb(skb);
|
|
|
|
+ return -EINVAL;
|
|
|
|
+ }
|
|
|
|
+
|
|
switch (tun->flags & TUN_TYPE_MASK) {
|
|
switch (tun->flags & TUN_TYPE_MASK) {
|
|
case IFF_TUN:
|
|
case IFF_TUN:
|
|
if (tun->flags & IFF_NO_PI) {
|
|
if (tun->flags & IFF_NO_PI) {
|
|
@@ -1280,13 +1287,6 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile,
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
|
|
|
|
- err = virtio_net_hdr_to_skb(skb, &gso, tun_is_little_endian(tun));
|
|
|
|
- if (err) {
|
|
|
|
- this_cpu_inc(tun->pcpu_stats->rx_frame_errors);
|
|
|
|
- kfree_skb(skb);
|
|
|
|
- return -EINVAL;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
/* copy skb_ubuf_info for callback when skb has no error */
|
|
/* copy skb_ubuf_info for callback when skb has no error */
|
|
if (zerocopy) {
|
|
if (zerocopy) {
|
|
skb_shinfo(skb)->destructor_arg = msg_control;
|
|
skb_shinfo(skb)->destructor_arg = msg_control;
|