kernel_samsung_a53x/drivers/virtio
Maximilian Heyne 46a0f70700 virtio-mmio: fix memory leak of vm_dev
commit fab7f259227b8f70aa6d54e1de1a1f5f4729041c 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: 55c91fedd03d ("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>
2024-11-18 10:58:28 +01:00
..
Kconfig Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Makefile Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
virtio.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
virtio_balloon.c virtio_balloon: Fix endless deflation and inflation on arm64 2024-11-18 10:58:28 +01:00
virtio_dma_buf.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
virtio_input.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
virtio_mem.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
virtio_mmio.c virtio-mmio: fix memory leak of vm_dev 2024-11-18 10:58:28 +01:00
virtio_pci_common.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
virtio_pci_common.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
virtio_pci_legacy.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
virtio_pci_modern.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
virtio_ring.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
virtio_vdpa.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00