hypervisor/ivshmem: Add ivshmem_dev_lock to protect deinit

Add the ivshmem_dev_lock to protect races between release
and allocations.

Tracked-On: ##8486

Signed-off-by: Zhang Chen <chen.zhang@intel.com>
Reviewed-by: Junjie Mao <junjie.mao@intel.com>
This commit is contained in:
Zhang Chen 2023-08-04 10:14:30 +08:00 committed by acrnsi-robot
parent c9c0d2167b
commit 45382dca4b

View File

@ -355,9 +355,12 @@ static void deinit_ivshmem_vdev(struct pci_vdev *vdev)
struct ivshmem_device *ivs_dev = (struct ivshmem_device *) vdev->priv_data;
ivshmem_server_unbind_peer(vdev);
ivs_dev->pcidev = NULL;
spinlock_obtain(&ivshmem_dev_lock);
vdev->priv_data = NULL;
vdev->user = NULL;
ivs_dev->pcidev = NULL;
spinlock_release(&ivshmem_dev_lock);
}
/**