From: Jeffy Chen <jeffy.chen@rock-chips.com>
To: linux-kernel@vger.kernel.org
Cc: Jeffy Chen <jeffy.chen@rock-chips.com>,
Thomas Gleixner <tglx@linutronix.de>
Subject: [PATCH] irq/generic-chip: Fix memory leak of domain->name
Date: Wed, 27 Sep 2017 20:28:16 +0800 [thread overview]
Message-ID: <20170927122816.18931-1-jeffy.chen@rock-chips.com> (raw)
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
next reply other threads:[~2017-09-27 12:28 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-27 12:28 Jeffy Chen [this message]
2017-09-27 13:29 ` Thomas Gleixner
2017-09-28 3:18 ` jeffy
2017-09-28 4:36 ` jeffy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170927122816.18931-1-jeffy.chen@rock-chips.com \
--to=jeffy.chen@rock-chips.com \
--cc=linux-kernel@vger.kernel.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®