mirror of
				https://github.com/qemu/qemu.git
				synced 2025-10-31 12:07:31 +00:00 
			
		
		
		
	|  0c9753ebda In legacy mode, virtio_pci_queue_enabled() falls back to
virtio_queue_enabled() to know if the queue is enabled.
But virtio_queue_enabled() calls again virtio_pci_queue_enabled()
if k->queue_enabled is set. This ends in a crash after a stack
overflow.
The problem can be reproduced with
"-device virtio-net-pci,disable-legacy=off,disable-modern=true
 -net tap,vhost=on"
And a look to the backtrace is very explicit:
    ...
    #4  0x000000010029a438 in virtio_queue_enabled ()
    #5  0x0000000100497a9c in virtio_pci_queue_enabled ()
    ...
    #130902 0x000000010029a460 in virtio_queue_enabled ()
    #130903 0x0000000100497a9c in virtio_pci_queue_enabled ()
    #130904 0x000000010029a460 in virtio_queue_enabled ()
    #130905 0x0000000100454a20 in vhost_net_start ()
    ...
This patch fixes the problem by introducing a new function
for the legacy case and calls it from virtio_pci_queue_enabled().
It also calls it from virtio_queue_enabled() to avoid code duplication.
Fixes:  | ||
|---|---|---|
| .. | ||
| vhost-backend.h | ||
| vhost-scsi-common.h | ||
| vhost-scsi.h | ||
| vhost-user-blk.h | ||
| vhost-user-fs.h | ||
| vhost-user-scsi.h | ||
| vhost-user-vsock.h | ||
| vhost-user.h | ||
| vhost-vdpa.h | ||
| vhost-vsock-common.h | ||
| vhost-vsock.h | ||
| vhost.h | ||
| virtio-access.h | ||
| virtio-balloon.h | ||
| virtio-blk.h | ||
| virtio-bus.h | ||
| virtio-crypto.h | ||
| virtio-gpu-bswap.h | ||
| virtio-gpu-pci.h | ||
| virtio-gpu-pixman.h | ||
| virtio-gpu.h | ||
| virtio-input.h | ||
| virtio-iommu.h | ||
| virtio-mem.h | ||
| virtio-mmio.h | ||
| virtio-net.h | ||
| virtio-pmem.h | ||
| virtio-rng.h | ||
| virtio-scsi.h | ||
| virtio-serial.h | ||
| virtio.h | ||