linux/drivers/vhost
Gautam Dawar 5a52215009 vhost-vdpa: free iommu domain after last use during cleanup
Currently vhost_vdpa_cleanup() unmaps the DMA mappings by calling
`iommu_unmap(v->domain, map->start, map->size);`
from vhost_vdpa_general_unmap() when the parent vDPA driver doesn't
provide DMA config operations.

However, the IOMMU domain referred to by `v->domain` is freed in
vhost_vdpa_free_domain() before vhost_vdpa_cleanup() in
vhost_vdpa_release() which results in NULL pointer de-reference.
Accordingly, moving the call to vhost_vdpa_free_domain() in
vhost_vdpa_cleanup() would makes sense. This will also help
detaching the dma device in error handling of vhost_vdpa_alloc_domain().

This issue was observed on terminating QEMU with SIGQUIT.

Fixes: 037d430556 ("vhost-vdpa: call vhost_vdpa_cleanup during the release")
Signed-off-by: Gautam Dawar <gautam.dawar@amd.com>
Message-Id: <20230301163203.29883-1-gautam.dawar@amd.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
2023-03-13 02:29:11 -04:00
..
iotlb.c vhost_iotlb: split out IOTLB initialization 2022-05-31 12:44:28 -04:00
Kconfig vhost_vdpa: implement IRQ offloading in vhost_vdpa 2020-08-05 11:08:42 -04:00
Makefile vhost: introduce vDPA-based backend 2020-04-02 10:41:40 -04:00
net.c vhost-net: support VIRTIO_F_RING_RESET 2023-02-20 19:26:59 -05:00
scsi.c vhost-scsi: convert sysfs snprintf and sprintf to sysfs_emit 2023-02-20 19:26:58 -05:00
test.c vhost-test: remove meaningless debug info 2023-02-20 19:26:58 -05:00
test.h tools/virtio: Add --reset 2020-06-22 12:34:21 -04:00
vdpa.c vhost-vdpa: free iommu domain after last use during cleanup 2023-03-13 02:29:11 -04:00
vhost.c vhost: remove unused paramete 2023-02-20 19:26:58 -05:00
vhost.h vhost: remove unused paramete 2023-02-20 19:26:58 -05:00
vringh.c vringh: use bvec_set_page to initialize a bvec 2023-02-03 10:17:42 -07:00
vsock.c virtio,vhost,vdpa: features, fixes 2023-02-25 11:48:02 -08:00