summaryrefslogtreecommitdiffstats
path: root/drivers/net/virtio_net.c
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@redhat.com>2014-10-23 23:22:11 +0200
committerMichael S. Tsirkin <mst@redhat.com>2014-12-09 11:05:28 +0100
commitbcff3162f3e0274a18648628ac8b5a36d2914b49 (patch)
treeb04aa558e691fffe712355d8a8b63a0006377050 /drivers/net/virtio_net.c
parentvirtio_net: get rid of virtio_net_hdr/skb_vnet_hdr (diff)
downloadlinux-bcff3162f3e0274a18648628ac8b5a36d2914b49.tar.xz
linux-bcff3162f3e0274a18648628ac8b5a36d2914b49.zip
virtio_net: stricter short buffer length checks
Our buffer length check is not strict enough for mergeable buffers: buffer can still be shorter that header + address by 2 bytes. Fix that up. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com> Reviewed-by: Jason Wang <jasowang@redhat.com>
Diffstat (limited to 'drivers/net/virtio_net.c')
-rw-r--r--drivers/net/virtio_net.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 516f2cb034b5..098f4432afa1 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -437,7 +437,7 @@ static void receive_buf(struct virtnet_info *vi, struct receive_queue *rq,
struct sk_buff *skb;
struct virtio_net_hdr_mrg_rxbuf *hdr;
- if (unlikely(len < sizeof(struct virtio_net_hdr) + ETH_HLEN)) {
+ if (unlikely(len < vi->hdr_len + ETH_HLEN)) {
pr_debug("%s: short packet %i\n", dev->name, len);
dev->stats.rx_length_errors++;
if (vi->mergeable_rx_bufs) {