[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC 4/4] virtio-net: Add MTU feature support
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [RFC 4/4] virtio-net: Add MTU feature support |
Date: |
Fri, 16 Sep 2016 00:16:29 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 |
On 06/09/2016 18:11, Maxime Coquelin wrote:
> VirtIONet *n = VIRTIO_NET(vdev);
> struct virtio_net_config netcfg;
>
> + if (virtio_vdev_has_feature(vdev, VIRTIO_NET_F_MTU)) {
> + virtio_stw_p(vdev, &netcfg.mtu, n->mtu);
> + }
This write needs to be unconditional, otherwise you are leaking a few
bytes of QEMU's stack (corresponding to netcfg.mtu) to the guest.
Paolo
> virtio_stw_p(vdev, &netcfg.status, n->status);
> virtio_stw_p(vdev, &netcfg.max_virtqueue_pairs, n->max_queues);
> memcpy(netcfg.mac, n->mac, ETH_ALEN);