diff options
author | Ingo Molnar <mingo@kernel.org> | 2015-10-12 09:51:18 +0200 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2015-10-12 09:51:18 +0200 |
commit | b9f27c0f4f7db9e5a4ba59228442a75d3177470c (patch) | |
tree | 49ab61b7e06a5a592f3541e84d1b5908a1d8030f /kernel/irq/proc.c | |
parent | 9fc4468d546b6eb55b0aa5b04b0c36238ebf57e7 (diff) | |
parent | 25cb62b76430a91cc6195f902e61c2cb84ade622 (diff) | |
download | kernel_replicant_linux-b9f27c0f4f7db9e5a4ba59228442a75d3177470c.tar.gz kernel_replicant_linux-b9f27c0f4f7db9e5a4ba59228442a75d3177470c.tar.bz2 kernel_replicant_linux-b9f27c0f4f7db9e5a4ba59228442a75d3177470c.zip |
Merge tag 'v4.3-rc5' into timers/core, to pick up fixes before applying new changes
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel/irq/proc.c')
-rw-r--r-- | kernel/irq/proc.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/kernel/irq/proc.c b/kernel/irq/proc.c index e3a8c9577ba6..a50ddc9417ff 100644 --- a/kernel/irq/proc.c +++ b/kernel/irq/proc.c @@ -12,6 +12,7 @@ #include <linux/seq_file.h> #include <linux/interrupt.h> #include <linux/kernel_stat.h> +#include <linux/mutex.h> #include "internals.h" @@ -323,18 +324,29 @@ void register_handler_proc(unsigned int irq, struct irqaction *action) void register_irq_proc(unsigned int irq, struct irq_desc *desc) { + static DEFINE_MUTEX(register_lock); char name [MAX_NAMELEN]; - if (!root_irq_dir || (desc->irq_data.chip == &no_irq_chip) || desc->dir) + if (!root_irq_dir || (desc->irq_data.chip == &no_irq_chip)) return; + /* + * irq directories are registered only when a handler is + * added, not when the descriptor is created, so multiple + * tasks might try to register at the same time. + */ + mutex_lock(®ister_lock); + + if (desc->dir) + goto out_unlock; + memset(name, 0, MAX_NAMELEN); sprintf(name, "%d", irq); /* create /proc/irq/1234 */ desc->dir = proc_mkdir(name, root_irq_dir); if (!desc->dir) - return; + goto out_unlock; #ifdef CONFIG_SMP /* create /proc/irq/<irq>/smp_affinity */ @@ -355,6 +367,9 @@ void register_irq_proc(unsigned int irq, struct irq_desc *desc) proc_create_data("spurious", 0444, desc->dir, &irq_spurious_proc_fops, (void *)(long)irq); + +out_unlock: + mutex_unlock(®ister_lock); } void unregister_irq_proc(unsigned int irq, struct irq_desc *desc) |