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

The platform resources need to be released when platform_device_add_data()
fails. Release the platform device and unregister the client notifier like
the error handling of platform_device_add().

Fixes: 922613436ae5 ("[ARM] 5200/1: am200epd: use fb notifiers and gpio api")
Signed-off-by: Lin Yujun <linyujun809@...wei.com>
---
 arch/arm/mach-pxa/am200epd.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-pxa/am200epd.c b/arch/arm/mach-pxa/am200epd.c
index cac0bb09db14..069b90df0759 100644
--- a/arch/arm/mach-pxa/am200epd.c
+++ b/arch/arm/mach-pxa/am200epd.c
@@ -370,12 +370,16 @@ int __init am200_init(void)
 		return -ENOMEM;
 
 	/* the am200_board that will be seen by metronomefb is a copy */
-	platform_device_add_data(am200_device, &am200_board,
+	ret = platform_device_add_data(am200_device, &am200_board,
 					sizeof(am200_board));
+	if (ret) {
+		platform_device_put(am200_device);
+		fb_unregister_client(&am200_fb_notif);
+		return ret;
+	}
 
 	/* this _add binds metronomefb to am200. metronomefb refcounts am200 */
 	ret = platform_device_add(am200_device);
-
 	if (ret) {
 		platform_device_put(am200_device);
 		fb_unregister_client(&am200_fb_notif);
-- 
2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ