From: Chuansheng Liu <chuansheng.liu@intel.com>
To: tglx@linutronix.de, mingo@redhat.com, suresh.b.siddha@intel.com,
yinghai@kernel.org
Cc: linux-kernel@vger.kernel.org, chuansheng.liu@intel.com
Subject: [PATCH] x86/ioapic: fix the irq_2_pin mem leak when destroy_irq
Date: Wed, 17 Oct 2012 18:11:46 +0800 [thread overview]
Message-ID: <1350468706.15558.26.camel@cliu38-desktop-build> (raw)
When destroying the irq, before free cfg, need to check
cfg->irq_2_pin and free it when it is not NULL.
Signed-off-by: liu chuansheng <chuansheng.liu@intel.com>
---
arch/x86/kernel/apic/io_apic.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index c265593..a976ee3 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -201,6 +201,15 @@ static struct irq_pin_list *alloc_irq_pin_list(int node)
return kzalloc_node(sizeof(struct irq_pin_list), GFP_KERNEL, node);
}
+static void free_irq_pin_list(struct irq_cfg *cfg)
+{
+ struct irq_pin_list *entry, *next;
+
+ for (entry = cfg->irq_2_pin; entry; entry = next) {
+ next = entry->next;
+ kfree(entry);
+ }
+}
/* irq_cfg is indexed by the sum of all RTEs in all I/O APICs. */
static struct irq_cfg irq_cfgx[NR_IRQS_LEGACY];
@@ -276,6 +285,7 @@ static void free_irq_cfg(unsigned int at, struct irq_cfg *cfg)
irq_set_chip_data(at, NULL);
free_cpumask_var(cfg->domain);
free_cpumask_var(cfg->old_domain);
+ free_irq_pin_list(cfg);
kfree(cfg);
}
--
1.7.0.4
next reply other threads:[~2012-10-17 1:12 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-17 10:11 Chuansheng Liu [this message]
2012-10-17 2:02 ` Yinghai Lu
2012-10-17 3:36 ` Liu, Chuansheng
2012-10-17 4:40 ` Yinghai Lu
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=1350468706.15558.26.camel@cliu38-desktop-build \
--to=chuansheng.liu@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=suresh.b.siddha@intel.com \
--cc=tglx@linutronix.de \
--cc=yinghai@kernel.org \
/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®