Revision 627aa460baf789b44cfd1d1285d6ad038c245959 authored by Zheyu Ma on 22 March 2024, 11:08:27 UTC, committed by Michael Tokarev on 09 April 2024, 18:15:00 UTC
This patch improves error handling in virtio_snd_handle_tx_xfer() and virtio_snd_handle_rx_xfer() in the VirtIO sound driver. Previously, 'goto' statements were used for error paths, leading to unnecessary processing and potential null pointer dereferences. Now, 'continue' is used to skip the rest of the current loop iteration for errors such as message size discrepancies or null streams, reducing crash risks. ASAN log illustrating the issue addressed: ERROR: AddressSanitizer: SEGV on unknown address 0x0000000000b4 #0 0x57cea39967b8 in qemu_mutex_lock_impl qemu/util/qemu-thread-posix.c:92:5 #1 0x57cea128c462 in qemu_mutex_lock qemu/include/qemu/thread.h:122:5 #2 0x57cea128d72f in qemu_lockable_lock qemu/include/qemu/lockable.h:95:5 #3 0x57cea128c294 in qemu_lockable_auto_lock qemu/include/qemu/lockable.h:105:5 #4 0x57cea1285eb2 in virtio_snd_handle_rx_xfer qemu/hw/audio/virtio-snd.c:1026:9 #5 0x57cea2caebbc in virtio_queue_notify_vq qemu/hw/virtio/virtio.c:2268:9 #6 0x57cea2cae412 in virtio_queue_host_notifier_read qemu/hw/virtio/virtio.c:3671:9 #7 0x57cea39822f1 in aio_dispatch_handler qemu/util/aio-posix.c:372:9 #8 0x57cea3979385 in aio_dispatch_handlers qemu/util/aio-posix.c:414:20 #9 0x57cea3978eb1 in aio_dispatch qemu/util/aio-posix.c:424:5 #10 0x57cea3a1eede in aio_ctx_dispatch qemu/util/async.c:360:5 Signed-off-by: Zheyu Ma <zheyuma97@gmail.com> Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org> Message-Id: <20240322110827.568412-1-zheyuma97@gmail.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> (cherry picked from commit a45f09935c88ae352a5ec120418a8b2b36ec1daa) Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
1 parent cd461c8
File | Mode | Size |
---|---|---|
bdrv-next-monitor-owned.c | -rw-r--r-- | 135 bytes |
blk-commit-all.c | -rw-r--r-- | 102 bytes |
blk-exp-close-all.c | -rw-r--r-- | 156 bytes |
blockdev-close-all-bdrv-states.c | -rw-r--r-- | 100 bytes |
change-state-handler.c | -rw-r--r-- | 312 bytes |
cmos.c | -rw-r--r-- | 117 bytes |
colo-compare.c | -rw-r--r-- | 116 bytes |
colo.c | -rw-r--r-- | 654 bytes |
cpu-get-clock.c | -rw-r--r-- | 149 bytes |
cpu-synchronize-state.c | -rw-r--r-- | 150 bytes |
cpus-get-virtual-clock.c | -rw-r--r-- | 153 bytes |
dump.c | -rw-r--r-- | 530 bytes |
error-printf.c | -rw-r--r-- | 539 bytes |
fdset.c | -rw-r--r-- | 266 bytes |
fw_cfg.c | -rw-r--r-- | 428 bytes |
gdbstub.c | -rw-r--r-- | 140 bytes |
get-vm-name.c | -rw-r--r-- | 109 bytes |
graph-lock.c | -rw-r--r-- | 150 bytes |
icount.c | -rw-r--r-- | 735 bytes |
io_uring.c | -rw-r--r-- | 603 bytes |
iothread-lock-block.c | -rw-r--r-- | 158 bytes |
iothread-lock.c | -rw-r--r-- | 224 bytes |
is-daemonized.c | -rw-r--r-- | 130 bytes |
isa-bus.c | -rw-r--r-- | 141 bytes |
linux-aio.c | -rw-r--r-- | 605 bytes |
memory_device.c | -rw-r--r-- | 352 bytes |
meson.build | -rw-r--r-- | 2.2 KB |
migr-blocker.c | -rw-r--r-- | 356 bytes |
module-opts.c | -rw-r--r-- | 54 bytes |
monitor-core.c | -rw-r--r-- | 421 bytes |
monitor.c | -rw-r--r-- | 384 bytes |
pci-bus.c | -rw-r--r-- | 152 bytes |
physmem.c | -rw-r--r-- | 249 bytes |
qdev.c | -rw-r--r-- | 664 bytes |
qemu-timer-notify-cb.c | -rw-r--r-- | 173 bytes |
qmp-command-available.c | -rw-r--r-- | 141 bytes |
qmp-quit.c | -rw-r--r-- | 156 bytes |
qtest.c | -rw-r--r-- | 431 bytes |
ram-block.c | -rw-r--r-- | 554 bytes |
ramfb.c | -rw-r--r-- | 301 bytes |
replay-tools.c | -rw-r--r-- | 1.3 KB |
replay.c | -rw-r--r-- | 347 bytes |
runstate-check.c | -rw-r--r-- | 135 bytes |
semihost-all.c | -rw-r--r-- | 339 bytes |
semihost.c | -rw-r--r-- | 1.2 KB |
sysbus.c | -rw-r--r-- | 107 bytes |
target-get-monitor-def.c | -rw-r--r-- | 984 bytes |
target-monitor-defs.c | -rw-r--r-- | 136 bytes |
trace-control.c | -rw-r--r-- | 976 bytes |
usb-dev-stub.c | -rw-r--r-- | 739 bytes |
uuid.c | -rw-r--r-- | 235 bytes |
virtio-md-pci.c | -rw-r--r-- | 719 bytes |
vm-stop.c | -rw-r--r-- | 183 bytes |
vmstate.c | -rw-r--r-- | 648 bytes |
win32-kbd-hook.c | -rw-r--r-- | 340 bytes |
xen-hw-stub.c | -rw-r--r-- | 843 bytes |
Computing file changes ...