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: f9d6dbf0bf6e ("virtio-net: remove virtio queues if the guest doesn't 
support multiqueue")
Buglink: https://issues.redhat.com/browse/RHEL-73842

Signed-off-by: Akihiko Odaki <akihiko.od...@daynix.com>
---
Changes in v2:
- Described possible consequences without this fix.
- Extracted the change to move virtio_reset() into another patch.
- Link to v1: 
https://lore.kernel.org/qemu-devel/20250410-reset-v1-1-751cd0064...@daynix.com

---
Akihiko Odaki (2):
      virtio: Call set_features during reset
      virtio: Move virtio_reset()

 hw/virtio/virtio.c | 86 +++++++++++++++++++++++++++---------------------------
 1 file changed, 43 insertions(+), 43 deletions(-)
---
base-commit: 825b96dbcee23d134b691fc75618b59c5f53da32
change-id: 20250406-reset-5ed5248ee3c1

Best regards,
-- 
Akihiko Odaki <akihiko.od...@daynix.com>


Reply via email to