public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] irq/generic-chip: Fix memory leak of domain->name
@ 2017-09-27 12:28 Jeffy Chen
  2017-09-27 13:29 ` Thomas Gleixner
  0 siblings, 1 reply; 4+ messages in thread
From: Jeffy Chen @ 2017-09-27 12:28 UTC (permalink / raw)
  To: linux-kernel; +Cc: Jeffy Chen, Thomas Gleixner

Free domain->name when IRQ_DOMAIN_NAME_ALLOCATED been set.

Fixes: d59f6617eef0 ("genirq: Allow fwnode to carry name information only")
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
---

 kernel/irq/generic-chip.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/kernel/irq/generic-chip.c b/kernel/irq/generic-chip.c
index f7086b78ad6e..174dae8ee7fe 100644
--- a/kernel/irq/generic-chip.c
+++ b/kernel/irq/generic-chip.c
@@ -322,6 +322,10 @@ 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);
 	}
+	if (d->flags & IRQ_DOMAIN_NAME_ALLOCATED) {
+		kfree(d->name);
+		d->flags &= ~IRQ_DOMAIN_NAME_ALLOCATED;
+	}
 	d->name = name;
 	return 0;
 }
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-09-28  4:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-27 12:28 [PATCH] irq/generic-chip: Fix memory leak of domain->name Jeffy Chen
2017-09-27 13:29 ` Thomas Gleixner
2017-09-28  3:18   ` jeffy
2017-09-28  4:36     ` jeffy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox