]> nv-tegra.nvidia Code Review - linux-2.6.git/commitdiff
x86, AMD IOMMU: initialize dma_ops after sysfs registration
authorJoerg Roedel <joerg.roedel@amd.com>
Thu, 14 Aug 2008 17:55:18 +0000 (19:55 +0200)
committerIngo Molnar <mingo@elte.hu>
Fri, 15 Aug 2008 11:56:56 +0000 (13:56 +0200)
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@amd.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
arch/x86/kernel/amd_iommu_init.c

index ceba33811537336dd4948350fa7a8433b978463e..a69cc0f5204286a9ead45b580e2f506c00a88f2a 100644 (file)
@@ -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;