[PATCH] x86_64 ioapic: check_timer_pin Don't add_pin_to_irq if it is already there.

From: Eric W. Biederman
Date: Mon Jan 08 2007 - 17:51:09 EST


"Lu, Yinghai" <yinghai.lu@xxxxxxx> writes:

>>Any updates to add_pin_to_irq are wrong. It works fine. If there
>>is something wrong we need to fix remove_pin_to_irq.
>
>>What is the problem you see? Sorry I'm dense at the moment.

> In the check_timer_pin, irq_from_pin could return 0, it mean some entry
> is for IRQ0 already.
> The add_pin_to_irq could add another same entry for it again.

Yep. My oversight. Here is the trivial patch to fix it. I don't
see how we could hit this case but if we are going to allow for it
we should handle it correctly.

Signed-off-by: Eric W. Biederman <ebiederm@xxxxxxxxxxxx>
---
arch/x86_64/kernel/io_apic.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/arch/x86_64/kernel/io_apic.c b/arch/x86_64/kernel/io_apic.c
index 4891959..cc8e9a4 100644
--- a/arch/x86_64/kernel/io_apic.c
+++ b/arch/x86_64/kernel/io_apic.c
@@ -1687,7 +1687,8 @@ static int check_timer_pin(int apic, int pin)
idx = update_irq0_entry(apic, pin);

/* Add an entry in irq_to_pin */
- add_pin_to_irq(0, apic, pin);
+ if (irq != 0)
+ add_pin_to_irq(0, apic, pin);

/* Now setup the irq */
setup_IO_APIC_irq(apic, pin, idx, 0);
--
1.4.4.1.g278f


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