Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1467444 > unrolled thread

[RESEND PATCH] genirq: fix potential memleak when failing to get irq pm

Started byShawn Lin <shawn.lin@rock-chips.com>
First post2016-08-22 10:30 +0200
Last post2016-08-22 11:30 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [RESEND PATCH] genirq: fix potential memleak when failing to get irq pm Shawn Lin <shawn.lin@rock-chips.com> - 2016-08-22 10:30 +0200
    [tip:irq/urgent] genirq: Fix potential memleak when failing to get  irq pm tip-bot for Shawn Lin <tipbot@zytor.com> - 2016-08-22 11:30 +0200

#1467444 — [RESEND PATCH] genirq: fix potential memleak when failing to get irq pm

FromShawn Lin <shawn.lin@rock-chips.com>
Date2016-08-22 10:30 +0200
Subject[RESEND PATCH] genirq: fix potential memleak when failing to get irq pm
Message-ID<s8SMh-3Ra-1@gated-at.bofh.it>
Obviously we should free action here if irq_chip_pm_get
failed.

Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
---

 kernel/irq/manage.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index 73a2b78..9530fcd 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -1681,8 +1681,10 @@ int request_threaded_irq(unsigned int irq, irq_handler_t handler,
 	action->dev_id = dev_id;
 
 	retval = irq_chip_pm_get(&desc->irq_data);
-	if (retval < 0)
+	if (retval < 0) {
+		kfree(action);
 		return retval;
+	}
 
 	chip_bus_lock(desc);
 	retval = __setup_irq(irq, desc, action);
@@ -1985,8 +1987,10 @@ int request_percpu_irq(unsigned int irq, irq_handler_t handler,
 	action->percpu_dev_id = dev_id;
 
 	retval = irq_chip_pm_get(&desc->irq_data);
-	if (retval < 0)
+	if (retval < 0) {
+		kfree(action);
 		return retval;
+	}
 
 	chip_bus_lock(desc);
 	retval = __setup_irq(irq, desc, action);
-- 
2.3.7

[toc] | [next] | [standalone]


#1467500 — [tip:irq/urgent] genirq: Fix potential memleak when failing to get irq pm

Fromtip-bot for Shawn Lin <tipbot@zytor.com>
Date2016-08-22 11:30 +0200
Subject[tip:irq/urgent] genirq: Fix potential memleak when failing to get irq pm
Message-ID<s8TIl-4sY-9@gated-at.bofh.it>
In reply to#1467444
Commit-ID:  4396f46c8c628329bd35ee4b84140b8b001a11eb
Gitweb:     http://git.kernel.org/tip/4396f46c8c628329bd35ee4b84140b8b001a11eb
Author:     Shawn Lin <shawn.lin@rock-chips.com>
AuthorDate: Mon, 22 Aug 2016 16:21:52 +0800
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Mon, 22 Aug 2016 11:22:44 +0200

genirq: Fix potential memleak when failing to get irq pm

Obviously we should free action here if irq_chip_pm_get failed.

Fixes: be45beb2df69: "genirq: Add runtime power management support for IRQ chips"
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Cc: Jon Hunter <jonathanh@nvidia.com>
Cc: Marc Zyngier <marc.zyngier@arm.com>
Link: http://lkml.kernel.org/r/1471854112-13006-1-git-send-email-shawn.lin@rock-chips.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

---
 kernel/irq/manage.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index 73a2b78..9530fcd 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -1681,8 +1681,10 @@ int request_threaded_irq(unsigned int irq, irq_handler_t handler,
 	action->dev_id = dev_id;
 
 	retval = irq_chip_pm_get(&desc->irq_data);
-	if (retval < 0)
+	if (retval < 0) {
+		kfree(action);
 		return retval;
+	}
 
 	chip_bus_lock(desc);
 	retval = __setup_irq(irq, desc, action);
@@ -1985,8 +1987,10 @@ int request_percpu_irq(unsigned int irq, irq_handler_t handler,
 	action->percpu_dev_id = dev_id;
 
 	retval = irq_chip_pm_get(&desc->irq_data);
-	if (retval < 0)
+	if (retval < 0) {
+		kfree(action);
 		return retval;
+	}
 
 	chip_bus_lock(desc);
 	retval = __setup_irq(irq, desc, action);

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web