diff options
author | Cyrill Gorcunov <gorcunov@gmail.com> | 2008-09-18 19:37:57 (GMT) |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-10-16 14:53:11 (GMT) |
commit | 5ffa4eb2224343ec3fbd492ffe71e28e797435b7 (patch) | |
tree | 728cd604177a5d4f392ef3f5290af37f06c8b033 /arch/x86/kernel/apic.c | |
parent | 2976fe20125587c944c8df48d991c38f0891fb28 (diff) | |
download | linux-fsl-qoriq-5ffa4eb2224343ec3fbd492ffe71e28e797435b7.tar.xz |
x86: io-apic - interrupt remapping fix
Interrupt remapping could lead to NULL dereference in case of
kzalloc failed and memory leak in other way. So fix the
both cases.
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: "Maciej W. Rozycki" <macro@linux-mips.org>
Cc: Suresh Siddha <suresh.b.siddha@intel.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/apic.c')
-rw-r--r-- | arch/x86/kernel/apic.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/arch/x86/kernel/apic.c b/arch/x86/kernel/apic.c index 7841169..1f48bd1 100644 --- a/arch/x86/kernel/apic.c +++ b/arch/x86/kernel/apic.c @@ -1360,7 +1360,12 @@ void enable_IR_x2apic(void) local_irq_save(flags); mask_8259A(); - save_mask_IO_APIC_setup(); + + ret = save_mask_IO_APIC_setup(); + if (ret) { + printk(KERN_INFO "Saving IO-APIC state failed: %d\n", ret); + goto end; + } ret = enable_intr_remapping(1); @@ -1370,14 +1375,15 @@ void enable_IR_x2apic(void) } if (ret) - goto end; + goto end_restore; if (!x2apic) { x2apic = 1; apic_ops = &x2apic_ops; enable_x2apic(); } -end: + +end_restore: if (ret) /* * IR enabling failed @@ -1386,6 +1392,7 @@ end: else reinit_intr_remapped_IO_APIC(x2apic_preenabled); +end: unmask_8259A(); local_irq_restore(flags); |