aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/tun.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 9c61f8734a40..c3cb60b1d1a2 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -1044,7 +1044,7 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile,
1044{ 1044{
1045 struct tun_pi pi = { 0, cpu_to_be16(ETH_P_IP) }; 1045 struct tun_pi pi = { 0, cpu_to_be16(ETH_P_IP) };
1046 struct sk_buff *skb; 1046 struct sk_buff *skb;
1047 size_t len = total_len, align = NET_SKB_PAD; 1047 size_t len = total_len, align = NET_SKB_PAD, linear;
1048 struct virtio_net_hdr gso = { 0 }; 1048 struct virtio_net_hdr gso = { 0 };
1049 int offset = 0; 1049 int offset = 0;
1050 int copylen; 1050 int copylen;
@@ -1108,10 +1108,13 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile,
1108 copylen = gso.hdr_len; 1108 copylen = gso.hdr_len;
1109 if (!copylen) 1109 if (!copylen)
1110 copylen = GOODCOPY_LEN; 1110 copylen = GOODCOPY_LEN;
1111 } else 1111 linear = copylen;
1112 } else {
1112 copylen = len; 1113 copylen = len;
1114 linear = gso.hdr_len;
1115 }
1113 1116
1114 skb = tun_alloc_skb(tfile, align, copylen, gso.hdr_len, noblock); 1117 skb = tun_alloc_skb(tfile, align, copylen, linear, noblock);
1115 if (IS_ERR(skb)) { 1118 if (IS_ERR(skb)) {
1116 if (PTR_ERR(skb) != -EAGAIN) 1119 if (PTR_ERR(skb) != -EAGAIN)
1117 tun->dev->stats.rx_dropped++; 1120 tun->dev->stats.rx_dropped++;