[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-iommu
Subject:    [PATCH 4/4] AMD IOMMU: initialize dma_ops after sysfs registration
From:       joerg.roedel () amd ! com (Joerg Roedel)
Date:       2008-08-14 17:55:18
Message-ID: 1218736518-25301-5-git-send-email-joerg.roedel () amd ! com
[Download RAW message or body]

If sysfs registration fails all memory used by IOMMU is freed. This happens
after dma_ops initialization and the functions will access the freed memory
then. Fix this by initializing dma_ops after the sysfs registration.

Signed-off-by: Joerg Roedel <joerg.roedel at amd.com>
---
 arch/x86/kernel/amd_iommu_init.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kernel/amd_iommu_init.c b/arch/x86/kernel/amd_iommu_init.c
index ceba338..a69cc0f 100644
--- a/arch/x86/kernel/amd_iommu_init.c
+++ b/arch/x86/kernel/amd_iommu_init.c
@@ -972,15 +972,15 @@ int __init amd_iommu_init(void)
 	if (acpi_table_parse("IVRS", init_memory_definitions) != 0)
 		goto free;
 
-	ret = amd_iommu_init_dma_ops();
+	ret = sysdev_class_register(&amd_iommu_sysdev_class);
 	if (ret)
 		goto free;
 
-	ret = sysdev_class_register(&amd_iommu_sysdev_class);
+	ret = sysdev_register(&device_amd_iommu);
 	if (ret)
 		goto free;
 
-	ret = sysdev_register(&device_amd_iommu);
+	ret = amd_iommu_init_dma_ops();
 	if (ret)
 		goto free;
 
-- 
1.5.3.7



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic