[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241119-fix-dereference-null-x86-sev-v1-1-82d59085e264@gmail.com>
Date: Tue, 19 Nov 2024 10:54:22 +0530
From: Shresth Prasad <shresthprasad7@...il.com>
To: Thomas Gleixner <tglx@...utronix.de>, Ingo Molnar <mingo@...hat.com>,
Borislav Petkov <bp@...en8.de>, Dave Hansen <dave.hansen@...ux.intel.com>,
x86@...nel.org, "H. Peter Anvin" <hpa@...or.com>
Cc: linux-kernel@...r.kernel.org, Shresth Prasad <shresthprasad7@...il.com>
Subject: [PATCH] x86/sev: Fix dereference NULL return value
Skip to the next CPU if `pte` is assigned NULL by `lookup_address`
This issue was reported by Coverity scan:
https://scan7.scan.coverity.com/#/project-view/52279/11354?selectedIssue=1601527
Signed-off-by: Shresth Prasad <shresthprasad7@...il.com>
---
arch/x86/coco/sev/core.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/x86/coco/sev/core.c b/arch/x86/coco/sev/core.c
index c5b0148b8c0a191f5aa38af73a52c77d6bba3e2d..0436366243e19a72bf9521f2e96a3ceec9c1270c 100644
--- a/arch/x86/coco/sev/core.c
+++ b/arch/x86/coco/sev/core.c
@@ -1079,6 +1079,8 @@ void snp_kexec_finish(void)
data = per_cpu(runtime_data, cpu);
ghcb = &data->ghcb_page;
pte = lookup_address((unsigned long)ghcb, &level);
+ if (!pte)
+ continue;
size = page_level_size(level);
set_pte_enc(pte, level, (void *)ghcb);
snp_set_memory_private((unsigned long)ghcb, (size / PAGE_SIZE));
---
base-commit: 28955f4fa2823e39f1ecfb3a37a364563527afbc
change-id: 20241119-fix-dereference-null-x86-sev-4b62d89e8b98
Best regards,
--
Shresth Prasad <shresthprasad7@...il.com>
Powered by blists - more mailing lists