[PATCH 1/6] x86,IRQ: Fix possible invalid memory access after IOAPIC hot-plugging

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Function free_ioapic_saved_registers() should mark ioapic->saved_regiters
as NULL after the memory has been freed. Otherwise when hot-adding
another IOAPIC, function alloc_ioapic_saved_registers() may reuse the
stale pointer and cause memory corruption.

Signed-off-by: Jiang Liu <jiang.liu@xxxxxxxxxx>
---
 arch/x86/kernel/apic/io_apic.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index da02320..7412eb8 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -362,6 +362,7 @@ static void alloc_ioapic_saved_registers(int idx)
 static void free_ioapic_saved_registers(int idx)
 {
 	kfree(ioapics[idx].saved_registers);
+	ioapics[idx].saved_registers = NULL;
 }
 
 int __init arch_early_irq_init(void)
-- 
1.7.5.4

--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux