diff options
author | Michael Dalton <mwdalton@google.com> | 2013-12-05 16:14:05 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-12-06 16:31:43 -0500 |
commit | 98bfd23cdb30e68e90571d7a2607e9479f8a50ec (patch) | |
tree | 42acca7d11c900abc8e45b2d1515e958e6cd4ca6 /drivers/net/virtio_net.c | |
parent | a328f3a0599e30d0d30333ec9f30cb1fa44c561a (diff) |
virtio-net: free bufs correctly on invalid packet length
When a packet with invalid length arrives, ensure that the packet
is freed correctly if mergeable packet buffers and big packets
(GUEST_TSO4) are both enabled.
Signed-off-by: Michael Dalton <mwdalton@google.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Acked-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/virtio_net.c')
-rw-r--r-- | drivers/net/virtio_net.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index c29376443428..d208f8604981 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c | |||
@@ -426,10 +426,10 @@ static void receive_buf(struct receive_queue *rq, void *buf, unsigned int len) | |||
426 | if (unlikely(len < sizeof(struct virtio_net_hdr) + ETH_HLEN)) { | 426 | if (unlikely(len < sizeof(struct virtio_net_hdr) + ETH_HLEN)) { |
427 | pr_debug("%s: short packet %i\n", dev->name, len); | 427 | pr_debug("%s: short packet %i\n", dev->name, len); |
428 | dev->stats.rx_length_errors++; | 428 | dev->stats.rx_length_errors++; |
429 | if (vi->big_packets) | 429 | if (vi->mergeable_rx_bufs) |
430 | give_pages(rq, buf); | ||
431 | else if (vi->mergeable_rx_bufs) | ||
432 | put_page(virt_to_head_page(buf)); | 430 | put_page(virt_to_head_page(buf)); |
431 | else if (vi->big_packets) | ||
432 | give_pages(rq, buf); | ||
433 | else | 433 | else |
434 | dev_kfree_skb(buf); | 434 | dev_kfree_skb(buf); |
435 | return; | 435 | return; |