Skip to contentSkip to conversation

genirq: Fix memory leak when calling irq_free_hwirqs()

PATCH New Keith Busch 2 participants 2 messages Jun 30, 2014 – Jul 5, 2014 IRQ

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 genirq: Fix memory leak when calling irq_free_hwirqs()

irq_free_hwirqs() always calls irq_free_descs() with a cnt == 0 which makes it a no-op since the interrupt count to free is decremented in itself.

Fixes 7b6ef1262549f6afc5c881aaef80beb8fd15f908
---
 kernel/irq/irqdesc.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/irq/irqdesc.c +2 -2
index 7339e42..1487a12 100644
@@ -455,9 +455,9 @@ EXPORT_SYMBOL_GPL(irq_alloc_hwirqs);
  */
 void irq_free_hwirqs(unsigned int from, int cnt)
 {
-	int i;
+	int i, j;
 
-	for (i = from; cnt > 0; i++, cnt--) {
+	for (i = from, j = cnt; j > 0; i++, j--) {
 		irq_set_status_flags(i, _IRQ_NOREQUEST | _IRQ_NOPROBE);
 		arch_teardown_hwirq(i);
 	}
Signature · 1 line
1.7.10.4
#1 lore raw
genirq: Fix memory leak when calling irq_free_hwirqs()
Commit-ID:  8844aad89ed61545b4db6a3467e1b21ca1c49460
Gitweb:     http://git.kernel.org/tip/8844aad89ed61545b4db6a3467e1b21ca1c49460
Author:     Keith Busch <[email protected]>
AuthorDate: Mon, 30 Jun 2014 16:24:44 -0600
Committer:  Thomas Gleixner <[email protected]>
CommitDate: Sat, 5 Jul 2014 21:42:08 +0200

genirq: Fix memory leak when calling irq_free_hwirqs()

irq_free_hwirqs() always calls irq_free_descs() with a cnt == 0 which makes it a no-op since the interrupt count to free is decremented in itself.

Fixes 7b6ef1262549f6afc5c881aaef80beb8fd15f908
---
 kernel/irq/irqdesc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/irq/irqdesc.c +2 -2
index 7339e42..1487a12 100644
@@ -455,9 +455,9 @@ EXPORT_SYMBOL_GPL(irq_alloc_hwirqs);
  */
 void irq_free_hwirqs(unsigned int from, int cnt)
 {
-	int i;
+	int i, j;
 
-	for (i = from; cnt > 0; i++, cnt--) {
+	for (i = from, j = cnt; j > 0; i++, j--) {
 		irq_set_status_flags(i, _IRQ_NOREQUEST | _IRQ_NOPROBE);
 		arch_teardown_hwirq(i);
 	}