aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorAkihiko Odaki <akihiko.odaki@daynix.com>2024-11-22 14:03:11 +0900
committerJason Wang <jasowang@redhat.com>2024-11-25 14:00:06 +0800
commit17437418c4ed0b779f7e9747fbffb08e139aa0ae (patch)
tree905786b7d995adfff23bec78025b351a34cc2f02 /hw
parent1981fa9d7da7a763b38ca2f583b9ec3a335cf661 (diff)
downloadqemu-17437418c4ed0b779f7e9747fbffb08e139aa0ae.zip
qemu-17437418c4ed0b779f7e9747fbffb08e139aa0ae.tar.gz
qemu-17437418c4ed0b779f7e9747fbffb08e139aa0ae.tar.bz2
virtio-net: Initialize hash reporting values
The specification says hash_report should be set to VIRTIO_NET_HASH_REPORT_NONE if VIRTIO_NET_F_HASH_REPORT is negotiated but not configured with VIRTIO_NET_CTRL_MQ_RSS_CONFIG. However, virtio_net_receive_rcu() instead wrote out the content of the extra_hdr variable, which is not uninitialized in such a case. Fix this by zeroing the extra_hdr. Fixes: e22f0603fb2f ("virtio-net: reference implementation of hash report") Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Jason Wang <jasowang@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/net/virtio-net.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index b544d2e..44ea72b 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -1911,6 +1911,8 @@ static ssize_t virtio_net_receive_rcu(NetClientState *nc, const uint8_t *buf,
size_t offset, i, guest_offset, j;
ssize_t err;
+ memset(&extra_hdr, 0, sizeof(extra_hdr));
+
if (n->rss_data.enabled && n->rss_data.enabled_software_rss) {
int index = virtio_net_process_rss(nc, buf, size, &extra_hdr);
if (index >= 0) {