mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [RESEND PATCH] genirq: fix potential memleak when failing to get irq pm
@ 2016-08-22  8:21 Shawn Lin
  2016-08-22  9:28 ` [tip:irq/urgent] genirq: Fix " tip-bot for Shawn Lin
  0 siblings, 1 reply; 2+ messages in thread
From: Shawn Lin @ 2016-08-22  8:21 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: linux-kernel, Shawn Lin

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-08-22  9:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-22  8:21 [RESEND PATCH] genirq: fix potential memleak when failing to get irq pm Shawn Lin
2016-08-22  9:28 ` [tip:irq/urgent] genirq: Fix " tip-bot for Shawn Lin

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®