[PATCH V2]irq/core: Add a length limitation

From: Liuweni
Date: Wed Nov 25 2009 - 09:00:20 EST


---
In this version, I modify the code by Ingo's suggestion,
and less code add.
The code will check the irqaction->name's length
and avoid Using too long name without any notice.
---
Signed-off-by: Liuwenyi<qingshenlwy@xxxxxxxxx>
Cc: Ingo Molnar <mingo@xxxxxxx>
Cc: Rusty Russell <rusty@xxxxxxxxxxxxxxx>
Cc: Mike Travis <travis@xxxxxxx>
Cc: Alexey Dobriyan <adobriyan@xxxxxxxxx>
Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Cc: linux-kernel@xxxxxxxxxxxxxxx

---
diff --git a/kernel/irq/proc.c b/kernel/irq/proc.c
index 0832145..b91dcb1 100644
--- a/kernel/irq/proc.c
+++ b/kernel/irq/proc.c
@@ -196,6 +196,8 @@ void register_handler_proc(unsigned int irq, struct irqaction *action)
char name [MAX_NAMELEN];
struct irq_desc *desc = irq_to_desc(irq);

+ WARN_ON(strlen(action->name) < MAX_NAMELEN);
+
if (!desc->dir || action->dir || !action->name ||
!name_unique(irq, action))
return;


--------------
Best Regards,
Liuweni
2009-11-25

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