WSL2-Linux-Kernel/drivers/virtio
Maximilian Heyne fbc9a8718f virtio-mmio: fix memory leak of vm_dev
commit fab7f25922 upstream.

With the recent removal of vm_dev from devres its memory is only freed
via the callback virtio_mmio_release_dev. However, this only takes
effect after device_add is called by register_virtio_device. Until then
it's an unmanaged resource and must be explicitly freed on error exit.

This bug was discovered and resolved using Coverity Static Analysis
Security Testing (SAST) by Synopsys, Inc.

Cc: stable@vger.kernel.org
Fixes: 55c91fedd0 ("virtio-mmio: don't break lifecycle of vm_dev")
Signed-off-by: Maximilian Heyne <mheyne@amazon.de>
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Tested-by: Catalin Marinas <catalin.marinas@arm.com>
Reviewed-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Message-Id: <20230911090328.40538-1-mheyne@amazon.de>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
2023-11-08 17:26:36 +01:00
..
Kconfig
Makefile
virtio.c virtio: acknowledge all features before access 2022-03-16 14:23:43 +01:00
virtio_balloon.c virtio_balloon: Fix endless deflation and inflation on arm64 2023-11-08 17:26:35 +01:00
virtio_dma_buf.c
virtio_input.c
virtio_mem.c virtio/virtio_mem: handle a possible NULL as a memcpy parameter 2022-01-27 11:02:59 +01:00
virtio_mmio.c virtio-mmio: fix memory leak of vm_dev 2023-11-08 17:26:36 +01:00
virtio_pci_common.c virtio-pci: Remove wrong address verification in vp_del_vqs() 2022-06-22 14:22:05 +02:00
virtio_pci_common.h
virtio_pci_legacy.c
virtio_pci_modern.c virtio_pci: modify ENOENT to EINVAL 2023-01-24 07:22:41 +01:00
virtio_pci_modern_dev.c virtio: pci: Fix an error handling path in vp_modern_probe() 2022-06-14 18:36:12 +02:00
virtio_ring.c virtio_ring: fix avail_wrap_counter in virtqueue_add_packed 2023-09-19 12:22:49 +02:00
virtio_vdpa.c