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]
Date:   Wed, 14 Sep 2022 11:34:55 +0800
From:   Lin Yujun <linyujun809@...wei.com>
To:     <daniel@...que.org>, <haojian.zhuang@...il.com>,
        <robert.jarzmik@...e.fr>, <linux@...linux.org.uk>,
        <jayakumar.lkml@...il.com>
CC:     <linux-arm-kernel@...ts.infradead.org>,
        <linux-kernel@...r.kernel.org>
Subject: [PATCH -next] [ARM] am300epd: Release platform device in case of platform_device_add_data() fails

The platform device need to be released when platform_device_add_data()
fails. Use platform_device_put() to release 'pdev' in error path.

Fixes: 4ce255c1420d ("[ARM] 5354/1: mach-pxa: add AM300 platform driver v3")
Signed-off-by: Lin Yujun <linyujun809@...wei.com>
---
 arch/arm/mach-pxa/am300epd.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-pxa/am300epd.c b/arch/arm/mach-pxa/am300epd.c
index 4b55bc89db8f..f8542b6aa9b7 100644
--- a/arch/arm/mach-pxa/am300epd.c
+++ b/arch/arm/mach-pxa/am300epd.c
@@ -275,11 +275,14 @@ int __init am300_init(void)
 		return -ENOMEM;
 
 	/* the am300_board that will be seen by broadsheetfb is a copy */
-	platform_device_add_data(am300_device, &am300_board,
+	ret = platform_device_add_data(am300_device, &am300_board,
 					sizeof(am300_board));
+	if (ret) {
+		platform_device_put(am300_device);
+		return ret;
+	}
 
 	ret = platform_device_add(am300_device);
-
 	if (ret) {
 		platform_device_put(am300_device);
 		return ret;
-- 
2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ