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>] [day] [month] [year] [list]
Message-Id: <20250526022358.3657209-1-haoxiang_li2024@163.com>
Date: Mon, 26 May 2025 10:23:58 +0800
From: Haoxiang Li <haoxiang_li2024@....com>
To: tglx@...utronix.de,
	mingo@...hat.com,
	bp@...en8.de,
	dave.hansen@...ux.intel.com,
	x86@...nel.org,
	hpa@...or.com,
	haoxiang_li2024@....com,
	dan.j.williams@...el.com
Cc: linux-kernel@...r.kernel.org,
	stable@...r.kernel.org
Subject: [PATCH] x86/pmem: Fix a null pointer dereference in register_e820_pmem()

Add check for the return value of platform_device_alloc()
to prevent null pointer dereference.

Fixes: 7a67832c7e44 ("libnvdimm, e820: make CONFIG_X86_PMEM_LEGACY a tristate option")
Cc: stable@...r.kernel.org
Signed-off-by: Haoxiang Li <haoxiang_li2024@....com>
---
 arch/x86/kernel/pmem.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/x86/kernel/pmem.c b/arch/x86/kernel/pmem.c
index 23154d24b117..04fb221716ff 100644
--- a/arch/x86/kernel/pmem.c
+++ b/arch/x86/kernel/pmem.c
@@ -27,6 +27,8 @@ static __init int register_e820_pmem(void)
 	 * simply here to trigger the module to load on demand.
 	 */
 	pdev = platform_device_alloc("e820_pmem", -1);
+	if (!pdev)
+		return -ENOMEM;
 
 	rc = platform_device_add(pdev);
 	if (rc)
-- 
2.25.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ