Commit c53cff5e42a06b81495983bd01741b9a954f11f0
Committed by
David S. Miller
1 parent
13a8e0c8cd
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
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>
Showing 1 changed file with 6 additions and 1 deletions Side-by-side Diff
drivers/vhost/net.c
... | ... | @@ -24,6 +24,7 @@ |
24 | 24 | #include <linux/if_arp.h> |
25 | 25 | #include <linux/if_tun.h> |
26 | 26 | #include <linux/if_macvlan.h> |
27 | +#include <linux/if_vlan.h> | |
27 | 28 | |
28 | 29 | #include <net/sock.h> |
29 | 30 | |
30 | 31 | |
... | ... | @@ -283,8 +284,12 @@ |
283 | 284 | |
284 | 285 | spin_lock_irqsave(&sk->sk_receive_queue.lock, flags); |
285 | 286 | head = skb_peek(&sk->sk_receive_queue); |
286 | - if (likely(head)) | |
287 | + if (likely(head)) { | |
287 | 288 | len = head->len; |
289 | + if (vlan_tx_tag_present(head)) | |
290 | + len += VLAN_HLEN; | |
291 | + } | |
292 | + | |
288 | 293 | spin_unlock_irqrestore(&sk->sk_receive_queue.lock, flags); |
289 | 294 | return len; |
290 | 295 | } |