mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-26 12:26:11 +00:00
vdpasim: fix memory leak when freeing IOTLBs
[ Upstream commit0b7a04a30e
] After commitbda324fd03
("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:bda324fd03
("vdpasim: control virtqueue support") Cc: Gautam Dawar <gautam.dawar@xilinx.com> Signed-off-by: Jason Wang <jasowang@redhat.com> Message-Id: <20221213090717.61529-1-jasowang@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Gautam Dawar <gautam.dawar@amd.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
8fe12680b2
commit
54b210c90d
1 changed files with 3 additions and 1 deletions
|
@ -679,7 +679,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);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue