irq: fix cpumask memory leak on offstack cpumask kernels
authorYinghai Lu <yinghai@kernel.org>
Tue, 31 Mar 2009 03:37:20 +0000 (20:37 -0700)
committerIngo Molnar <mingo@elte.hu>
Fri, 3 Apr 2009 17:14:44 +0000 (19:14 +0200)
Need to free the old cpumask for affinity and pending_mask.

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Acked-by: Rusty Russell <rusty@rustcorp.com.au>
LKML-Reference: <49D18FF0.50707@kernel.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
include/linux/irq.h
kernel/irq/numa_migrate.c

index 974890b3c52fbfe0048df3cf7d736798caf873b6..99d147efe399acf66ef6275a9455bc7ef36bebba 100644 (file)
@@ -482,6 +482,16 @@ static inline void init_copy_desc_masks(struct irq_desc *old_desc,
 #endif
 }
 
+static inline void free_desc_masks(struct irq_desc *old_desc,
+                                  struct irq_desc *new_desc)
+{
+       free_cpumask_var(old_desc->affinity);
+
+#ifdef CONFIG_GENERIC_PENDING_IRQ
+       free_cpumask_var(old_desc->pending_mask);
+#endif
+}
+
 #else /* !CONFIG_SMP */
 
 static inline bool init_alloc_desc_masks(struct irq_desc *desc, int cpu,
@@ -495,6 +505,10 @@ static inline void init_copy_desc_masks(struct irq_desc *old_desc,
 {
 }
 
+static inline void free_desc_masks(struct irq_desc *old_desc,
+                                  struct irq_desc *new_desc)
+{
+}
 #endif /* CONFIG_SMP */
 
 #endif /* _LINUX_IRQ_H */
index 243d6121e50e08c1b54972fd3bb61c827a8c3dfe..44bbdcbaf8d2c8193f2d631b54061047546d0065 100644 (file)
@@ -54,6 +54,7 @@ static bool init_copy_one_irq_desc(int irq, struct irq_desc *old_desc,
 static void free_one_irq_desc(struct irq_desc *old_desc, struct irq_desc *desc)
 {
        free_kstat_irqs(old_desc, desc);
+       free_desc_masks(old_desc, desc);
        arch_free_chip_data(old_desc, desc);
 }