All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kvm: nVMX: off by one in vmx_write_pml_buffer()
@ 2017-05-10 19:43 ` Dan Carpenter
  0 siblings, 0 replies; 20+ messages in thread
From: Dan Carpenter @ 2017-05-10 19:43 UTC (permalink / raw)
  To: Paolo Bonzini, Bandan Das
  Cc: Radim Krčmář,
	Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86, kvm,
	kernel-janitors

There are PML_ENTITY_NUM elements in the pml_address[] array so the >
should be >= or we write beyond the end of the array when we do:

	pml_address[vmcs12->guest_pml_index--] = gpa;

Fixes: c5f983f6e845 ("nVMX: Implement emulated Page Modification Logging")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index c6f4ad44aa95..7698e8f321bf 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -11213,7 +11213,7 @@ static int vmx_write_pml_buffer(struct kvm_vcpu *vcpu)
 		if (!nested_cpu_has_pml(vmcs12))
 			return 0;
 
-		if (vmcs12->guest_pml_index > PML_ENTITY_NUM) {
+		if (vmcs12->guest_pml_index >= PML_ENTITY_NUM) {
 			vmx->nested.pml_full = true;
 			return 1;
 		}

^ permalink raw reply related	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2017-05-16 13:56 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-10 19:43 [PATCH] kvm: nVMX: off by one in vmx_write_pml_buffer() Dan Carpenter
2017-05-10 19:43 ` Dan Carpenter
2017-05-10 20:18 ` Bandan Das
2017-05-10 20:18   ` Bandan Das
2017-05-10 20:43   ` [PATCH v2] " Dan Carpenter
2017-05-10 20:43     ` Dan Carpenter
2017-05-11  7:31     ` Paolo Bonzini
2017-05-11  7:31       ` Paolo Bonzini
2017-05-11  7:42       ` Dan Carpenter
2017-05-11  7:42         ` Dan Carpenter
2017-05-11  7:52         ` Paolo Bonzini
2017-05-11  7:52           ` Paolo Bonzini
2017-05-11 13:56       ` Bandan Das
2017-05-11 13:56         ` Bandan Das
2017-05-11 15:23         ` Paolo Bonzini
2017-05-11 15:23           ` Paolo Bonzini
2017-05-11 17:06           ` Bandan Das
2017-05-11 17:06             ` Bandan Das
2017-05-16 13:56 ` [PATCH] " Radim Krčmář
2017-05-16 13:56   ` Radim Krčmář

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.