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: <20211227125154.3145-1-linmq006@gmail.com>
Date:   Mon, 27 Dec 2021 12:51:53 +0000
From:   Miaoqian Lin <linmq006@...il.com>
To:     unlisted-recipients:; (no To-header on input)
Cc:     linmq006@...il.com, Daniel Mack <daniel@...que.org>,
        Haojian Zhuang <haojian.zhuang@...il.com>,
        Robert Jarzmik <robert.jarzmik@...e.fr>,
        Russell King <linux@...linux.org.uk>,
        Marc Zyngier <marc.zyngier@...ran.com>,
        linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: [PATCH] ARM: pxa: Fix error handling in viper_tpm_init

tpm_device get by platform_device_alloc(), which calls device_initialize.
Call platform_device_put(tpm_device) instead of kfree(tmp_device) to
prevent memory leak.

Fixes: 352699a ("Basic support for the Arcom/Eurotech Viper SBC.")
Signed-off-by: Miaoqian Lin <linmq006@...il.com>
---
 arch/arm/mach-pxa/viper.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-pxa/viper.c b/arch/arm/mach-pxa/viper.c
index 3aa34e9a15d3..9a0f184dbecb 100644
--- a/arch/arm/mach-pxa/viper.c
+++ b/arch/arm/mach-pxa/viper.c
@@ -815,11 +815,11 @@ static void __init viper_tpm_init(void)
 					      sizeof(i2c_tpm_data))) {
 			if (platform_device_add(tpm_device)) {
 				errstr = "register TPM i2c bus";
-				goto error_free_tpm;
+				goto exit_put_device;
 			}
 		} else {
 			errstr = "allocate TPM i2c bus data";
-			goto error_free_tpm;
+			goto exit_put_device;
 		}
 	} else {
 		errstr = "allocate TPM i2c device";
@@ -827,9 +827,8 @@ static void __init viper_tpm_init(void)
 	}
 
 	return;
-
-error_free_tpm:
-	kfree(tpm_device);
+exit_put_device:
+	platform_device_put(tpm_device);
 error_tpm:
 	pr_err("viper: Couldn't %s, giving up\n", errstr);
 }
-- 
2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ