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


Groups > linux.kernel > #1467444

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

From Shawn Lin <shawn.lin@rock-chips.com>
Newsgroups linux.kernel
Subject [RESEND PATCH] genirq: fix potential memleak when failing to get irq pm
Date 2016-08-22 10:30 +0200
Message-ID <s8SMh-3Ra-1@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[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

csiph-web