diff options
author | Basil Gor <basil.gor@gmail.com> | 2012-05-03 18:55:23 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-05-11 18:16:57 -0400 |
commit | c53cff5e42a06b81495983bd01741b9a954f11f0 (patch) | |
tree | ede51285061a64bf44cfacfd93580d9707fd32b9 /drivers/vhost | |
parent | 13a8e0c8cdb43982372bd6c65fb26839c8fd8ce9 (diff) |
vhost-net: fix handle_rx buffer size
Take vlan header length into account, when vlan id is stored as
vlan_tci. Otherwise tagged packets coming from macvtap will be
truncated.
Signed-off-by: Basil Gor <basil.gor@gmail.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/vhost')
-rw-r--r-- | drivers/vhost/net.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c index 1f21d2a1e528..5c170100de9c 100644 --- a/drivers/vhost/net.c +++ b/drivers/vhost/net.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/if_arp.h> | 24 | #include <linux/if_arp.h> |
25 | #include <linux/if_tun.h> | 25 | #include <linux/if_tun.h> |
26 | #include <linux/if_macvlan.h> | 26 | #include <linux/if_macvlan.h> |
27 | #include <linux/if_vlan.h> | ||
27 | 28 | ||
28 | #include <net/sock.h> | 29 | #include <net/sock.h> |
29 | 30 | ||
@@ -283,8 +284,12 @@ static int peek_head_len(struct sock *sk) | |||
283 | 284 | ||
284 | spin_lock_irqsave(&sk->sk_receive_queue.lock, flags); | 285 | spin_lock_irqsave(&sk->sk_receive_queue.lock, flags); |
285 | head = skb_peek(&sk->sk_receive_queue); | 286 | head = skb_peek(&sk->sk_receive_queue); |
286 | if (likely(head)) | 287 | if (likely(head)) { |
287 | len = head->len; | 288 | len = head->len; |
289 | if (vlan_tx_tag_present(head)) | ||
290 | len += VLAN_HLEN; | ||
291 | } | ||
292 | |||
288 | spin_unlock_irqrestore(&sk->sk_receive_queue.lock, flags); | 293 | spin_unlock_irqrestore(&sk->sk_receive_queue.lock, flags); |
289 | return len; | 294 | return len; |
290 | } | 295 | } |