[patch, 2.6.9-rc4-mm1] fix rmmod uhci_hcd oops

From: Ingo Molnar
Date: Sat Oct 16 2004 - 11:08:52 EST



this patch fixes the rmmod oops reported by Paul Fulghum. It is caused
by the generic-irqs subsystem creating multiple /proc/irq/<nr>/<name>
directory entries with the same name which then confuses procfs upon
module removal.

Ingo

Signed-off-by: Ingo Molnar <mingo@xxxxxxx>

--- linux/kernel/irq/proc.c.orig
+++ linux/kernel/irq/proc.c
@@ -66,11 +66,24 @@ static int irq_affinity_write_proc(struc

#define MAX_NAMELEN 128

+static int name_unique(unsigned int irq, struct irqaction *new_action)
+{
+ struct irq_desc *desc = irq_desc + irq;
+ struct irqaction *action;
+
+ for (action = desc->action ; action; action = action->next)
+ if ((action != new_action) && action->name &&
+ !strcmp(new_action->name, action->name))
+ return 0;
+ return 1;
+}
+
void register_handler_proc(unsigned int irq, struct irqaction *action)
{
char name [MAX_NAMELEN];

- if (!irq_dir[irq] || action->dir || !action->name)
+ if (!irq_dir[irq] || action->dir || !action->name ||
+ !name_unique(irq, action))
return;

memset(name, 0, MAX_NAMELEN);

-
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/