提交 0b7a04a3 编写于 作者: J Jason Wang 提交者: Michael S. Tsirkin

vdpasim: fix memory leak when freeing IOTLBs

After commit bda324fd ("vdpasim: control virtqueue support"),
vdpasim->iommu became an array of IOTLB, so we should clean the
mappings of each free one by one instead of just deleting the ranges
in the first IOTLB which may leak maps.

Fixes: bda324fd ("vdpasim: control virtqueue support")
Cc: Gautam Dawar <gautam.dawar@xilinx.com>
Signed-off-by: NJason Wang <jasowang@redhat.com>
Message-Id: <20221213090717.61529-1-jasowang@redhat.com>
Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
Reviewed-by: NGautam Dawar <gautam.dawar@amd.com>
上级 1c96d545
...@@ -689,7 +689,9 @@ static void vdpasim_free(struct vdpa_device *vdpa) ...@@ -689,7 +689,9 @@ static void vdpasim_free(struct vdpa_device *vdpa)
} }
kvfree(vdpasim->buffer); kvfree(vdpasim->buffer);
vhost_iotlb_free(vdpasim->iommu); for (i = 0; i < vdpasim->dev_attr.nas; i++)
vhost_iotlb_reset(&vdpasim->iommu[i]);
kfree(vdpasim->iommu);
kfree(vdpasim->vqs); kfree(vdpasim->vqs);
kfree(vdpasim->config); kfree(vdpasim->config);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册