Skip to content

Commit

Permalink
x86, AMD IOMMU: initialize dma_ops after sysfs registration
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Joerg Roedel authored and Ingo Molnar committed Aug 15, 2008
1 parent 8a45669 commit 129d6ab
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions arch/x86/kernel/amd_iommu_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 129d6ab

Please sign in to comment.