diff options
author | Cyrill Gorcunov <gorcunov@gmail.com> | 2008-09-18 15:37:57 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-10-16 10:53:11 -0400 |
commit | 5ffa4eb2224343ec3fbd492ffe71e28e797435b7 (patch) | |
tree | 728cd604177a5d4f392ef3f5290af37f06c8b033 /arch/x86/kernel/apic.c | |
parent | 2976fe20125587c944c8df48d991c38f0891fb28 (diff) |
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 784116933c70..1f48bd1c9f2d 100644 --- a/arch/x86/kernel/apic.c +++ b/arch/x86/kernel/apic.c | |||
@@ -1360,7 +1360,12 @@ void enable_IR_x2apic(void) | |||
1360 | 1360 | ||
1361 | local_irq_save(flags); | 1361 | local_irq_save(flags); |
1362 | mask_8259A(); | 1362 | mask_8259A(); |
1363 | save_mask_IO_APIC_setup(); | 1363 | |
1364 | ret = save_mask_IO_APIC_setup(); | ||
1365 | if (ret) { | ||
1366 | printk(KERN_INFO "Saving IO-APIC state failed: %d\n", ret); | ||
1367 | goto end; | ||
1368 | } | ||
1364 | 1369 | ||
1365 | ret = enable_intr_remapping(1); | 1370 | ret = enable_intr_remapping(1); |
1366 | 1371 | ||
@@ -1370,14 +1375,15 @@ void enable_IR_x2apic(void) | |||
1370 | } | 1375 | } |
1371 | 1376 | ||
1372 | if (ret) | 1377 | if (ret) |
1373 | goto end; | 1378 | goto end_restore; |
1374 | 1379 | ||
1375 | if (!x2apic) { | 1380 | if (!x2apic) { |
1376 | x2apic = 1; | 1381 | x2apic = 1; |
1377 | apic_ops = &x2apic_ops; | 1382 | apic_ops = &x2apic_ops; |
1378 | enable_x2apic(); | 1383 | enable_x2apic(); |
1379 | } | 1384 | } |
1380 | end: | 1385 | |
1386 | end_restore: | ||
1381 | if (ret) | 1387 | if (ret) |
1382 | /* | 1388 | /* |
1383 | * IR enabling failed | 1389 | * IR enabling failed |
@@ -1386,6 +1392,7 @@ end: | |||
1386 | else | 1392 | else |
1387 | reinit_intr_remapped_IO_APIC(x2apic_preenabled); | 1393 | reinit_intr_remapped_IO_APIC(x2apic_preenabled); |
1388 | 1394 | ||
1395 | end: | ||
1389 | unmask_8259A(); | 1396 | unmask_8259A(); |
1390 | local_irq_restore(flags); | 1397 | local_irq_restore(flags); |
1391 | 1398 | ||