qemu/hw
Zheyu Ma 89cf6574bc hw/virtio/virtio-crypto: Fix op_code assignment in virtio_crypto_create_asym_session
Currently, if the function fails during the key_len check, the op_code
does not have a proper value, causing virtio_crypto_free_create_session_req
not to free the memory correctly, leading to a memory leak.

By setting the op_code before performing any checks, we ensure that
virtio_crypto_free_create_session_req has the correct context to
perform cleanup operations properly, thus preventing memory leaks.

ASAN log:
==3055068==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 512 byte(s) in 1 object(s) allocated from:
    #0 0x5586a75e6ddd in malloc llvm/compiler-rt/lib/asan/asan_malloc_linux.cpp:129:3
    #1 0x7fb6b63b6738 in g_malloc (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x5e738)
    #2 0x5586a864bbde in virtio_crypto_handle_ctrl hw/virtio/virtio-crypto.c:407:19
    #3 0x5586a94fc84c in virtio_queue_notify_vq hw/virtio/virtio.c:2277:9
    #4 0x5586a94fc0a2 in virtio_queue_host_notifier_read hw/virtio/virtio.c:3641:9

Signed-off-by: Zheyu Ma <zheyuma97@gmail.com>
Message-Id: <20240702211835.3064505-1-zheyuma97@gmail.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2024-07-21 14:31:59 -04:00
..
9pfs hw/xen: Make XenDevOps structures const 2024-06-04 11:53:43 +02:00
acpi hw/acpi/ich9: Remove dead code related to 'acpi_memory_hotplug' 2024-06-19 12:40:49 +02:00
adc hw, target: Add ResetType argument to hold and exit phase methods 2024-04-25 10:21:06 +01:00
alpha alpha: switch boards to "default y" 2024-05-03 15:47:47 +02:00
arm hw/arm/smmu: Refactor SMMU OAS 2024-07-18 13:49:30 +01:00
audio hw/audio/virtio-snd: Always use little endian audio format 2024-06-19 12:40:49 +02:00
avr avr: switch boards to "default y" 2024-05-03 15:47:47 +02:00
block hw/block: m25p80: support quad mode for w25q01jvq 2024-07-09 08:05:44 +02:00
char hw/char/pl011: Avoid division-by-zero in pl011_get_baudrate() 2024-07-11 11:41:33 +01:00
core * target/i386/tcg: fixes for seg_helper.c 2024-07-17 15:40:28 +10:00
cpu hw: Add a Kconfig switch for the TYPE_CPU_CLUSTER device 2024-04-25 12:48:12 +02:00
cris cris: switch boards to "default y" 2024-05-03 15:47:47 +02:00
cxl hw/cxl/cxl-mailbox-utils: Add superset extent release mailbox support 2024-07-01 17:16:04 -04:00
display hw/display/bcm2835_fb: fix fb_use_offsets condition 2024-07-18 13:49:29 +01:00
dma hw/dma: Add a trace log for a description loading failure 2024-06-18 14:52:00 +02:00
fsi hw/fsi: Aspeed APB2OPB & On-chip peripheral bus 2024-02-01 08:33:18 +01:00
gpio hw/gpio/aspeed: Add reg_table_count to AspeedGPIOClass 2024-07-02 07:52:43 +02:00
hppa hw/hppa/machine: Replace g_memdup() by g_memdup2() 2024-05-08 19:42:45 +02:00
hyperv kvm: move target-dependent interrupt routing out of kvm-all.c 2024-05-03 15:47:48 +02:00
i2c hw, target: Add ResetType argument to hold and exit phase methods 2024-04-25 10:21:06 +01:00
i386 trivial patches for 2024-07-17 2024-07-18 10:07:23 +10:00
ide hw/ide/macio: switch from using qemu_allocate_irq() to qdev input GPIOs 2024-07-02 06:58:48 +02:00
input hw: arm: Remove use of tabs in some source files 2024-05-28 14:20:48 +01:00
intc virtio: features,fixes 2024-07-03 20:54:17 -07:00
ipack hw/ipack: Constify VMState 2023-12-29 11:17:30 +11:00
ipmi hw/ipmi: Constify VMState 2023-12-29 11:17:30 +11:00
isa hw/isa/vt82c686: Turn "intr" irq into a named gpio 2024-07-16 20:04:08 +02:00
loongarch hw/loongarch/virt: Remove unused assignment 2024-07-12 09:41:18 +08:00
m68k hw: skip registration of outdated versioned machine types 2024-07-02 06:58:37 +02:00
mem hw/cxl/events: Improve QMP interfaces and documentation for add/release dynamic capacity. 2024-07-03 18:14:07 -04:00
microblaze microblaze: switch boards to "default y" 2024-05-03 15:47:47 +02:00
mips hw/isa/vt82c686: Turn "intr" irq into a named gpio 2024-07-16 20:04:08 +02:00
misc hw/misc: In STM32L4x5 EXTI, handle direct interrupts 2024-07-11 11:41:34 +01:00
net hw/net:ftgmac100: update TX and RX packet buffers address to 64 bits 2024-07-09 08:05:44 +02:00
nubus hw/nubus: add nubus-virtio-mmio device 2024-02-27 09:36:39 +01:00
nvme hw/nvme: Expand VI/VQ resource to uint32 2024-07-11 17:05:37 +02:00
nvram hw/nvram: Add BCM2835 OTP device 2024-07-01 12:48:55 +01:00
openrisc kconfig: express dependency of individual boards on libfdt 2024-05-10 15:45:15 +02:00
pci hw/pci: Replace -1 with UINT32_MAX for romsize 2024-07-03 18:14:07 -04:00
pci-bridge Misc HW patch queue 2024-04-25 09:43:29 -07:00
pci-host hw/ppc: Avoid using Monitor in pnv_phb4_pic_print_info() 2024-06-19 12:40:49 +02:00
pcmcia
ppc hw/isa/vt82c686: Turn "intr" irq into a named gpio 2024-07-16 20:04:08 +02:00
remote hw/remote/vfio-user: Fix config space access byte order 2024-05-08 19:43:15 +02:00
riscv hw/riscv/virt.c: re-insert and deprecate 'riscv,delegate' 2024-07-18 12:08:45 +10:00
rtc hw/i386: move rtc-reset-reinjection command out of hw/rtc 2024-05-10 15:45:15 +02:00
rx kconfig: express dependency of individual boards on libfdt 2024-05-10 15:45:15 +02:00
s390x virtio: features,fixes 2024-07-03 20:54:17 -07:00
scsi * target/i386/tcg: fixes for seg_helper.c 2024-07-17 15:40:28 +10:00
sd hw/sd/sdcard: Support boot area in emmc image 2024-07-16 20:30:15 +02:00
sensor hw, target: Add ResetType argument to hold and exit phase methods 2024-04-25 10:21:06 +01:00
sh4 hw/sh4: Remove newline character in trace events 2024-06-10 13:05:27 -04:00
smbios hw/smbios: Remove 'smbios_uuid_encoded', simplify smbios_encode_uuid() 2024-06-19 12:40:49 +02:00
sparc sparc: switch boards to "default y" 2024-05-03 15:47:48 +02:00
sparc64 qemu-sparc queue 2024-05-06 10:19:56 -07:00
ssi aspeed/smc: Add AST2700 support 2024-06-16 21:08:54 +02:00
timer hpet: fix HPET_TN_SETVAL for high 32-bits of the comparator 2024-07-16 18:18:24 +02:00
tpm hw/tpm: Remove HOST_PAGE_ALIGN from tpm_ppi_init 2024-02-29 11:35:36 -10:00
tricore tricore: switch boards to "default y" 2024-05-03 15:47:48 +02:00
ufs hw/ufs: Fix mcq register range check logic 2024-07-14 17:11:21 +09:00
usb hw/usb/u2f-passthru: Get rid of qemu_open_old() 2024-07-17 14:04:15 +03:00
vfio hw/vfio/container: Get rid of qemu_open_old() 2024-07-17 14:04:15 +03:00
virtio hw/virtio/virtio-crypto: Fix op_code assignment in virtio_crypto_create_asym_session 2024-07-21 14:31:59 -04:00
watchdog aspeed/wdt: Add AST2700 support 2024-06-16 21:08:54 +02:00
xen xen: mapcache: Fix unmapping of first entries in buckets 2024-07-12 00:17:36 +02:00
xenpv hw/xen: Register framebuffer backend via xen_backend_init() 2024-06-04 11:53:43 +02:00
xtensa hw/xtensa: require libfdt 2024-05-10 15:45:15 +02:00
Kconfig hw: Fix problem with the A*MPCORE switches in the Kconfig files 2024-04-25 12:48:12 +02:00
meson.build hw/rdma: Remove deprecated pvrdma device and rdmacm-mux helper 2024-04-24 16:03:38 +02:00