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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LNX.2.00.1208072014140.3227@swampdragon.chaosbits.net>
Date:	Tue, 7 Aug 2012 20:16:55 +0200 (CEST)
From:	Jesper Juhl <jj@...osbits.net>
To:	Dmitry Torokhov <dmitry.torokhov@...il.com>
cc:	Sourav Poddar <sourav.poddar@...com>, Felipe Balbi <balbi@...com>,
	JJ Ding <dgdunix@...il.com>, linux-input@...r.kernel.org,
	linux-kernel@...r.kernel.org, Abraham Arce <x0066660@...com>,
	Syed Rafiuddin <rafiuddin.syed@...com>
Subject: [PATCH] Input: omap4-keypad - don't leak in omap4_keypad_probe()

If omap4_keypad_parse_dt() does not return 0 (zero) in
omap4_keypad_probe() we will leak the memory we allocated for
'keypad_data' with kzalloc() when we return and the variable goes out
of scope.
Fix the leak by jumping to the 'err_free_keypad' label where we
properly free the allocated memory, instead of returning directly.

Signed-off-by: Jesper Juhl <jj@...osbits.net>
---
 drivers/input/keyboard/omap4-keypad.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

 Compile tested only.

diff --git a/drivers/input/keyboard/omap4-keypad.c b/drivers/input/keyboard/omap4-keypad.c
index c05f98c..9c2ac87 100644
--- a/drivers/input/keyboard/omap4-keypad.c
+++ b/drivers/input/keyboard/omap4-keypad.c
@@ -281,7 +281,7 @@ static int __devinit omap4_keypad_probe(struct platform_device *pdev)
 	} else {
 		error = omap4_keypad_parse_dt(&pdev->dev, keypad_data);
 		if (error)
-			return error;
+			goto err_free_keypad;
 	}
 
 	res = request_mem_region(res->start, resource_size(res), pdev->name);
-- 
1.7.11.4


-- 
Jesper Juhl <jj@...osbits.net>       http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
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