irq/generic-chip: Don't replace domain's name
PATCH v2 1/1 irq/generic-chip: Don't replace domain's name
Currently we are replacing domain's name with irq chip's name when allocating generic chips.
When the old domain's name is allocated, it would cause memory leak. Even worse the domain framework would try to free the wrong name later.
---
Changes in v2:
Don't replace domain's name instead of trying to free the old name.
kernel/irq/generic-chip.c | 1 - 1 file changed, 1 deletion(-)
kernel/irq/generic-chip.c +0 -1
@@ -322,7 +322,6 @@ int __irq_alloc_domain_generic_chips(struct irq_domain *d, int irqs_per_chip,/* Calc pointer to the next generic chip */ tmp +=sizeof (*gc) + num_ct *sizeof (struct irq_chip_type ); } - d->name = name;return 0 ; }EXPORT_SYMBOL_GPL (__irq_alloc_domain_generic_chips);
Signature · 1 line
2.11.0
tip-bot for Jeffy Chen
merge botirq/generic-chip: Don't replace domain's name
Commit-ID: 72364d320644c12948786962673772f271039a4a Gitweb: https://git.kernel.org/tip/72364d320644c12948786962673772f271039a4a Author: Jeffy Chen <[email protected]> AuthorDate: Thu, 28 Sep 2017 12:37:31 +0800 Committer: Thomas Gleixner <[email protected]> CommitDate: Thu, 28 Sep 2017 12:18:59 +0200
irq/generic-chip: Don't replace domain's name
When generic irq chips are allocated for an irq domain the domain name is set to the irq chip name. That was done to have named domains before the recent changes which enforce domain naming were done.
Since then the overwrite causes a memory leak when the domain name is dynamically allocated and even worse it would cause the domain free code to free the wrong name pointer, which might point to a constant.
Remove the name assignment to prevent this.
--- kernel/irq/generic-chip.c | 1 - 1 file changed, 1 deletion(-)
kernel/irq/generic-chip.c +0 -1
@@ -322,7 +322,6 @@ int __irq_alloc_domain_generic_chips(struct irq_domain *d, int irqs_per_chip,/* Calc pointer to the next generic chip */ tmp +=sizeof (*gc) + num_ct *sizeof (struct irq_chip_type ); } - d->name = name;return 0 ; }EXPORT_SYMBOL_GPL (__irq_alloc_domain_generic_chips);