提交 fedd27b3 编写于 作者: Z Zhou Guanghui 提交者: Yang Yingliang

arm64/ascend: fix memleak when remove svm

ascend inclusion
category: bugfix
bugzilla: NA
CVE: NA

-------------------------------------------------

shutdown Shared Virtual Addressing for a device which initialized
by iommu_sva_device_init()
Signed-off-by: NZhou Guanghui <zhouguanghui1@huawei.com>
Reviewed-by: NHanjun Guo <guohanjun@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 c947dfcf
...@@ -246,6 +246,7 @@ static int svm_remove_core(struct device *dev, void *data) ...@@ -246,6 +246,7 @@ static int svm_remove_core(struct device *dev, void *data)
struct core_device *cdev = to_core_device(dev); struct core_device *cdev = to_core_device(dev);
if (!cdev->smmu_bypass) { if (!cdev->smmu_bypass) {
iommu_sva_device_shutdown(dev);
iommu_detach_group(cdev->domain, cdev->group); iommu_detach_group(cdev->domain, cdev->group);
iommu_group_put(cdev->group); iommu_group_put(cdev->group);
iommu_domain_free(cdev->domain); iommu_domain_free(cdev->domain);
...@@ -1769,6 +1770,11 @@ static int svm_device_remove(struct platform_device *pdev) ...@@ -1769,6 +1770,11 @@ static int svm_device_remove(struct platform_device *pdev)
return 0; return 0;
} }
static void svm_device_shutdown(struct platform_device *pdev)
{
svm_device_remove(pdev);
}
static const struct acpi_device_id svm_acpi_match[] = { static const struct acpi_device_id svm_acpi_match[] = {
{ "HSVM1980", 0}, { "HSVM1980", 0},
{ } { }
...@@ -1785,6 +1791,7 @@ MODULE_DEVICE_TABLE(of, svm_of_match); ...@@ -1785,6 +1791,7 @@ MODULE_DEVICE_TABLE(of, svm_of_match);
static struct platform_driver svm_driver = { static struct platform_driver svm_driver = {
.probe = svm_device_probe, .probe = svm_device_probe,
.remove = svm_device_remove, .remove = svm_device_remove,
.shutdown = svm_device_shutdown,
.driver = { .driver = {
.name = SVM_DEVICE_NAME, .name = SVM_DEVICE_NAME,
.acpi_match_table = ACPI_PTR(svm_acpi_match), .acpi_match_table = ACPI_PTR(svm_acpi_match),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册