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-prev] [day] [month] [year] [list]
Message-ID: <165574151164.4207.15439194073733618682.tip-bot2@tip-bot2>
Date:   Mon, 20 Jun 2022 16:11:51 -0000
From:   "tip-bot2 for Johan Hovold" <tip-bot2@...utronix.de>
To:     linux-tip-commits@...r.kernel.org
Cc:     Johan Hovold <johan@...nel.org>, Borislav Petkov <bp@...e.de>,
        x86@...nel.org, linux-kernel@...r.kernel.org
Subject: [tip: x86/misc] x86/pmem: Fix platform-device leak in error path

The following commit has been merged into the x86/misc branch of tip:

Commit-ID:     229e73d46994f15314f58b2d39bf952111d89193
Gitweb:        https://git.kernel.org/tip/229e73d46994f15314f58b2d39bf952111d89193
Author:        Johan Hovold <johan@...nel.org>
AuthorDate:    Mon, 20 Jun 2022 16:07:23 +02:00
Committer:     Borislav Petkov <bp@...e.de>
CommitterDate: Mon, 20 Jun 2022 18:01:16 +02:00

x86/pmem: Fix platform-device leak in error path

Make sure to free the platform device in the unlikely event that
registration fails.

Fixes: 7a67832c7e44 ("libnvdimm, e820: make CONFIG_X86_PMEM_LEGACY a tristate option")
Signed-off-by: Johan Hovold <johan@...nel.org>
Signed-off-by: Borislav Petkov <bp@...e.de>
Link: https://lore.kernel.org/r/20220620140723.9810-1-johan@kernel.org
---
 arch/x86/kernel/pmem.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kernel/pmem.c b/arch/x86/kernel/pmem.c
index 6b07faa..23154d2 100644
--- a/arch/x86/kernel/pmem.c
+++ b/arch/x86/kernel/pmem.c
@@ -27,6 +27,11 @@ static __init int register_e820_pmem(void)
 	 * simply here to trigger the module to load on demand.
 	 */
 	pdev = platform_device_alloc("e820_pmem", -1);
-	return platform_device_add(pdev);
+
+	rc = platform_device_add(pdev);
+	if (rc)
+		platform_device_put(pdev);
+
+	return rc;
 }
 device_initcall(register_e820_pmem);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ