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: <20240412084703.1407412-1-wjduan@linx-info.com>
Date: Fri, 12 Apr 2024 16:47:03 +0800
From: Wujie Duan <wjduan@...x-info.com>
To: zhaotianrui@...ngson.cn,
	maobibo@...ngson.cn,
	chenhuacai@...nel.org,
	kernel@...0n.name
Cc: kvm@...r.kernel.org,
	loongarch@...ts.linux.dev,
	linux-kernel@...r.kernel.org,
	Wujie Duan <wjduan@...x-info.com>
Subject: [PATCH] KVM: loongarch: Add vcpu id check before create vcpu

Add a pre-allocation arch condition to checks that vcpu id should
smaller than max_vcpus

Signed-off-by: Wujie Duan <wjduan@...x-info.com>
---
 arch/loongarch/kvm/vcpu.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/loongarch/kvm/vcpu.c b/arch/loongarch/kvm/vcpu.c
index 3a8779065f73..d41cacf39583 100644
--- a/arch/loongarch/kvm/vcpu.c
+++ b/arch/loongarch/kvm/vcpu.c
@@ -884,6 +884,9 @@ long kvm_arch_vcpu_async_ioctl(struct file *filp,
 
 int kvm_arch_vcpu_precreate(struct kvm *kvm, unsigned int id)
 {
+	if (id >= kvm->max_vcpus)
+		return -EINVAL;
+
 	return 0;
 }
 
-- 
2.40.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ