Skip to content

Commit

Permalink
irq: fix cpumask memory leak on offstack cpumask kernels
Browse files Browse the repository at this point in the history
Need to free the old cpumask for affinity and pending_mask.

Signed-off-by: Yinghai Lu <[email protected]>
Acked-by: Rusty Russell <[email protected]>
LKML-Reference: <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
  • Loading branch information
Yinghai Lu authored and Ingo Molnar committed Apr 3, 2009
1 parent 8fe74cf commit 9756b15
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
14 changes: 14 additions & 0 deletions include/linux/irq.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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 */
1 change: 1 addition & 0 deletions kernel/irq/numa_migrate.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit 9756b15

Please sign in to comment.