lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1445213365-24530-3-git-send-email-alexey.klimov@linaro.org>
Date:	Mon, 19 Oct 2015 03:09:25 +0300
From:	Alexey Klimov <alexey.klimov@...aro.org>
To:	daniel.lezcano@...aro.org, matthias.bgg@...il.com,
	linux-kernel@...r.kernel.org
Cc:	linux-mediatek@...ts.infradead.org, yingjoe.chen@...iatek.com,
	tglx@...utronix.de, klimov.linux@...il.com, joe@...ches.com,
	Alexey Klimov <alexey.klimov@...aro.org>
Subject: [PATCH v2 3/3] clocksource: mtk_timer: fix memleak in mtk_timer_init()

Add error path to clear evt struct allocated by kzalloc()
in the beginning of function mtk_timer_init().

Acked-by: Matthias Brugger <matthias.bgg@...il.com>
Signed-off-by: Alexey Klimov <alexey.klimov@...aro.org>
---
 drivers/clocksource/mtk_timer.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/clocksource/mtk_timer.c b/drivers/clocksource/mtk_timer.c
index ac92ca2..a811e7c 100644
--- a/drivers/clocksource/mtk_timer.c
+++ b/drivers/clocksource/mtk_timer.c
@@ -200,7 +200,7 @@ static void __init mtk_timer_init(struct device_node *node)
 	evt->gpt_base = of_io_request_and_map(node, 0, "mtk-timer");
 	if (IS_ERR(evt->gpt_base)) {
 		pr_err("Can't get resource\n");
-		return;
+		goto err_kzalloc;
 	}
 
 	evt->dev.irq = irq_of_parse_and_map(node, 0);
@@ -255,5 +255,7 @@ err_mem:
 	iounmap(evt->gpt_base);
 	of_address_to_resource(node, 0, &res);
 	release_mem_region(res.start, resource_size(&res));
+err_kzalloc:
+	kfree(evt);
 }
 CLOCKSOURCE_OF_DECLARE(mtk_mt6577, "mediatek,mt6577-timer", mtk_timer_init);
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ