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: <20220914033317.98469-1-linyujun809@huawei.com>
Date:   Wed, 14 Sep 2022 11:33:17 +0800
From:   Lin Yujun <linyujun809@...wei.com>
To:     <daniel@...que.org>, <haojian.zhuang@...il.com>,
        <robert.jarzmik@...e.fr>, <linux@...linux.org.uk>, <lg@...x.de>,
        <eric.miao@...vell.com>
CC:     <linux-arm-kernel@...ts.infradead.org>,
        <linux-kernel@...r.kernel.org>
Subject: [PATCH -next] ARM pxa2xx: Add missing platform_device_put() in pxa2xx_set_spi_info()

In error case in pxa2xx_set_spi_info() after calling
platform_device_add(), the failed 'pdev' need to be
release or it will be leak, call platform_device_put()
to fix this problem.

Fixes: e172274ccc55 ("[ARM] 5088/3: pxa2xx: add pxa2xx_set_spi_info to register pxa2xx-spi platform devices")
Signed-off-by: Lin Yujun <linyujun809@...wei.com>
---
 arch/arm/mach-pxa/devices.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-pxa/devices.c b/arch/arm/mach-pxa/devices.c
index a7b92dd1ca9e..2727f0138758 100644
--- a/arch/arm/mach-pxa/devices.c
+++ b/arch/arm/mach-pxa/devices.c
@@ -1087,7 +1087,11 @@ void __init pxa2xx_set_spi_info(unsigned id, struct pxa2xx_spi_controller *info)
 	}
 
 	pd->dev.platform_data = info;
-	platform_device_add(pd);
+	if (platform_device_add(pd)) {
+		printk(KERN_ERR "pxa2xx-spi: failed to add platform device %d\n",
+			id);
+		platform_device_put(pd);
+	}
 }
 
 static struct resource pxa_dma_resource[] = {
-- 
2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ