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]
Date:   Thu, 21 Mar 2019 04:30:22 -0700
From:   tip-bot for Kangjie Lu <tipbot@...or.com>
To:     linux-tip-commits@...r.kernel.org
Cc:     sashal@...nel.org, mojha@...eaurora.org, hpa@...or.com,
        kys@...rosoft.com, sthemmin@...rosoft.com, kjlu@....edu,
        linux-kernel@...r.kernel.org, mingo@...nel.org, bp@...en8.de,
        tglx@...utronix.de, haiyangz@...rosoft.com
Subject: [tip:x86/urgent] x86/hyperv: Prevent potential NULL pointer
 dereference

Commit-ID:  534c89c22e26b183d838294f0937ee092c82ad3a
Gitweb:     https://git.kernel.org/tip/534c89c22e26b183d838294f0937ee092c82ad3a
Author:     Kangjie Lu <kjlu@....edu>
AuthorDate: Thu, 14 Mar 2019 00:46:51 -0500
Committer:  Thomas Gleixner <tglx@...utronix.de>
CommitDate: Thu, 21 Mar 2019 12:24:39 +0100

x86/hyperv: Prevent potential NULL pointer dereference

The page allocation in hv_cpu_init() can fail, but the code does not
have a check for that.

Add a check and return -ENOMEM when the allocation fails.

[ tglx: Massaged changelog ]

Signed-off-by: Kangjie Lu <kjlu@....edu>
Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
Reviewed-by: Mukesh Ojha <mojha@...eaurora.org>
Acked-by: "K. Y. Srinivasan" <kys@...rosoft.com>
Cc: pakki001@....edu
Cc: Haiyang Zhang <haiyangz@...rosoft.com>
Cc: Stephen Hemminger <sthemmin@...rosoft.com>
Cc: Sasha Levin <sashal@...nel.org>
Cc: Borislav Petkov <bp@...en8.de>
Cc: "H. Peter Anvin" <hpa@...or.com>
Cc: linux-hyperv@...r.kernel.org
Link: https://lkml.kernel.org/r/20190314054651.1315-1-kjlu@umn.edu

---
 arch/x86/hyperv/hv_init.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/arch/x86/hyperv/hv_init.c b/arch/x86/hyperv/hv_init.c
index 6461a16b4559..e4ba467a9fc6 100644
--- a/arch/x86/hyperv/hv_init.c
+++ b/arch/x86/hyperv/hv_init.c
@@ -103,9 +103,13 @@ static int hv_cpu_init(unsigned int cpu)
 	u64 msr_vp_index;
 	struct hv_vp_assist_page **hvp = &hv_vp_assist_page[smp_processor_id()];
 	void **input_arg;
+	struct page *pg;
 
 	input_arg = (void **)this_cpu_ptr(hyperv_pcpu_input_arg);
-	*input_arg = page_address(alloc_page(GFP_KERNEL));
+	pg = alloc_page(GFP_KERNEL);
+	if (unlikely(!pg))
+		return -ENOMEM;
+	*input_arg = page_address(pg);
 
 	hv_get_vp_index(msr_vp_index);
 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ