Skip to contentSkip to conversation

irq: fix cpumask leaking

PATCH In review Yinghai Lu 1 participant 2 messages Mar 31, 2009 – Apr 3, 2009 IRQ

lore
Share & tools
lore

Yinghai Lu

author
#0 lore raw

PATCH 1/1 irq: fix cpumask leaking

Impact: fix bug

need to free the old cpumask for affinit and pending_mask

---
 include/linux/irq.h       |   14 ++++++++++++++
 kernel/irq/numa_migrate.c |    1 +
 2 files changed, 15 insertions(+)
kernel/irq/numa_migrate.c +1 -0
Index: linux-2.6/kernel/irq/numa_migrate.c
===================================================================
@@ -54,6 +54,7 @@ static bool init_copy_one_irq_desc(int i
 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);
 }
 
include/linux/irq.h +14 -0
Index: linux-2.6/include/linux/irq.h
===================================================================
@@ -489,6 +489,16 @@ static inline void init_copy_desc_masks(
 #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 alloc_desc_masks(struct irq_desc *desc, int cpu,
@@ -506,6 +516,10 @@ static inline void init_copy_desc_masks(
 {
 }
 
+static inline void free_desc_masks(struct irq_desc *old_desc,
+				   struct irq_desc *new_desc)
+{
+}
 #endif	/* CONFIG_SMP */
 
 #endif /* _LINUX_IRQ_H */
author
#1 lore raw

[tip:irq/urgent] irq: fix cpumask memory leak on offstack cpumask kernels

Commit-ID:  9756b15e1b58453a6fd54b85c1ad8515209e10bb
Gitweb:     http://git.kernel.org/tip/9756b15e1b58453a6fd54b85c1ad8515209e10bb
Author:     Yinghai Lu <[email protected]>
AuthorDate: Mon, 30 Mar 2009 20:37:20 -0700
Committer:  Ingo Molnar <[email protected]>
CommitDate: Fri, 3 Apr 2009 19:14:44 +0200

irq: fix cpumask memory leak on offstack cpumask kernels

Need to free the old cpumask for affinity and pending_mask.

LKML-Reference: <[email protected]>

---
 include/linux/irq.h       |   14 ++++++++++++++
 kernel/irq/numa_migrate.c |    1 +
 2 files changed, 15 insertions(+), 0 deletions(-)
include/linux/irq.h +14 -0
index 974890b..99d147e 100644
@@ -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 */
kernel/irq/numa_migrate.c +1 -0
index 243d612..44bbdcb 100644
@@ -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);
 }