Commit 98bfd23c authored by Michael Dalton's avatar Michael Dalton Committed by David S. Miller

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: default avatarMichael Dalton <mwdalton@google.com>
Acked-by: default avatarJason Wang <jasowang@redhat.com>
Acked-by: default avatarAndrew Vagin <avagin@openvz.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a328f3a0
...@@ -426,10 +426,10 @@ static void receive_buf(struct receive_queue *rq, void *buf, unsigned int len) ...@@ -426,10 +426,10 @@ static void receive_buf(struct receive_queue *rq, void *buf, unsigned int len)
if (unlikely(len < sizeof(struct virtio_net_hdr) + ETH_HLEN)) { if (unlikely(len < sizeof(struct virtio_net_hdr) + ETH_HLEN)) {
pr_debug("%s: short packet %i\n", dev->name, len); pr_debug("%s: short packet %i\n", dev->name, len);
dev->stats.rx_length_errors++; dev->stats.rx_length_errors++;
if (vi->big_packets) if (vi->mergeable_rx_bufs)
give_pages(rq, buf);
else if (vi->mergeable_rx_bufs)
put_page(virt_to_head_page(buf)); put_page(virt_to_head_page(buf));
else if (vi->big_packets)
give_pages(rq, buf);
else else
dev_kfree_skb(buf); dev_kfree_skb(buf);
return; return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment