Skip to content

Commit 037d430

Browse files
stefano-garzarellamstsirkin
authored andcommitted
vhost-vdpa: call vhost_vdpa_cleanup during the release
Before commit 3d56987 ("vhost-vdpa: introduce asid based IOTLB") we call vhost_vdpa_iotlb_free() during the release to clean all regions mapped in the iotlb. That commit removed vhost_vdpa_iotlb_free() and added vhost_vdpa_cleanup() to do some cleanup, including deleting all mappings, but we forgot to call it in vhost_vdpa_release(). This causes that if an application does not remove all mappings explicitly (or it crashes), the mappings remain in the iotlb and subsequent applications may fail if they map the same addresses. Calling vhost_vdpa_cleanup() also fixes a memory leak since we are not freeing `v->vdev.vqs` during the release from the same commit. Since vhost_vdpa_cleanup() calls vhost_dev_cleanup() we can remove its call from vhost_vdpa_release(). Fixes: 3d56987 ("vhost-vdpa: introduce asid based IOTLB") Cc: [email protected] Signed-off-by: Stefano Garzarella <[email protected]> Message-Id: <[email protected]> Signed-off-by: Michael S. Tsirkin <[email protected]> Tested-by: Eugenio Pérez <[email protected]> Acked-by: Jason Wang <[email protected]>
1 parent e0c2ce8 commit 037d430

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/vhost/vdpa.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1209,7 +1209,7 @@ static int vhost_vdpa_release(struct inode *inode, struct file *filep)
12091209
vhost_dev_stop(&v->vdev);
12101210
vhost_vdpa_free_domain(v);
12111211
vhost_vdpa_config_put(v);
1212-
vhost_dev_cleanup(&v->vdev);
1212+
vhost_vdpa_cleanup(v);
12131213
mutex_unlock(&d->mutex);
12141214

12151215
atomic_dec(&v->opened);

0 commit comments

Comments
 (0)