From 0a61e0d99495271900c61106f7c3e573e599e032 Mon Sep 17 00:00:00 2001 From: lijunwei Date: Tue, 23 Sep 2025 15:50:23 +0800 Subject: [PATCH] virtio-net expects set_features() will be called when the feature set used by the guest changes to update the number of virtqueues but it is not called during reset, which will clear all features, leaving the queues added for VIRTIO_NET_F_MQ or VIRTIO_NET_F_RSS. Not only these extra queues are visible to the guest, they will cause segmentation fault during migration. Call set_features() during reset to remove those queues for virtio-net as we call set_status(). It will also prevent similar bugs for virtio-net and other devices in the future. Fixes: f9d6dbf0 ("virtio-net: remove virtio queues if the guest doesn't support multiqueue") Buglink: https://issues.redhat.com/browse/RHEL-73842 Cc: qemu-stable@nongnu.org Signed-off-by: default avatarAkihiko Odaki Message-Id: <20250421-reset-v2-1-e4c1ead88ea1@daynix.com> Reviewed-by: MST's avatarMichael S. Tsirkin Signed-off-by: MST's avatarMichael S. Tsirkin (cherry picked from commit 0caed25c) Signed-off-by: default avatarMichael Tokarev --- hw/virtio/virtio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index f57b6c955e..74b711f473 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -2223,7 +2223,7 @@ void virtio_reset(void *opaque) vdev->start_on_kick = false; vdev->started = false; vdev->broken = false; - vdev->guest_features = 0; + virtio_set_features_nocheck(vdev, 0); vdev->queue_sel = 0; vdev->status = 0; vdev->disabled = false; -- Gitee