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

Ingo Molnar
2004-10-16T16:06:26Z

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@elte.hu>

--- 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);