* [PATCH] x86: KVM: svm: Fix a check in nested_svm_vmrun()
@ 2019-08-27 9:38 Dan Carpenter
2019-08-27 12:28 ` Vitaly Kuznetsov
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Dan Carpenter @ 2019-08-27 9:38 UTC (permalink / raw)
To: Paolo Bonzini, Vitaly Kuznetsov
Cc: Radim Krčmář, Sean Christopherson, Wanpeng Li,
Jim Mattson, Joerg Roedel, Thomas Gleixner, Ingo Molnar,
Borislav Petkov, H. Peter Anvin, x86, kvm, kernel-janitors
We refactored this code a bit and accidentally deleted the "-" character
from "-EINVAL". The kvm_vcpu_map() function never returns positive
EINVAL.
Fixes: c8e16b78c614 ("x86: KVM: svm: eliminate hardcoded RIP advancement from vmrun_interception()")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
From static analysis. I don't really know the impact.
arch/x86/kvm/svm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index 1f220a85514f..ef646e22d1ab 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -3598,7 +3598,7 @@ static int nested_svm_vmrun(struct vcpu_svm *svm)
vmcb_gpa = svm->vmcb->save.rax;
ret = kvm_vcpu_map(&svm->vcpu, gpa_to_gfn(vmcb_gpa), &map);
- if (ret = EINVAL) {
+ if (ret = -EINVAL) {
kvm_inject_gp(&svm->vcpu, 0);
return 1;
} else if (ret) {
--
2.20.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] x86: KVM: svm: Fix a check in nested_svm_vmrun()
2019-08-27 9:38 [PATCH] x86: KVM: svm: Fix a check in nested_svm_vmrun() Dan Carpenter
@ 2019-08-27 12:28 ` Vitaly Kuznetsov
2019-08-27 13:39 ` Sean Christopherson
2019-09-11 15:28 ` Paolo Bonzini
2 siblings, 0 replies; 4+ messages in thread
From: Vitaly Kuznetsov @ 2019-08-27 12:28 UTC (permalink / raw)
To: Dan Carpenter, Paolo Bonzini
Cc: Radim Krčmář, Sean Christopherson, Wanpeng Li,
Jim Mattson, Joerg Roedel, Thomas Gleixner, Ingo Molnar,
Borislav Petkov, H. Peter Anvin, x86, kvm, kernel-janitors
Dan Carpenter <dan.carpenter@oracle.com> writes:
> We refactored this code a bit and accidentally deleted the "-" character
> from "-EINVAL". The kvm_vcpu_map() function never returns positive
> EINVAL.
>
> Fixes: c8e16b78c614 ("x86: KVM: svm: eliminate hardcoded RIP advancement from vmrun_interception()")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> From static analysis. I don't really know the impact.
>
>
> arch/x86/kvm/svm.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
> index 1f220a85514f..ef646e22d1ab 100644
> --- a/arch/x86/kvm/svm.c
> +++ b/arch/x86/kvm/svm.c
> @@ -3598,7 +3598,7 @@ static int nested_svm_vmrun(struct vcpu_svm *svm)
> vmcb_gpa = svm->vmcb->save.rax;
>
> ret = kvm_vcpu_map(&svm->vcpu, gpa_to_gfn(vmcb_gpa), &map);
> - if (ret = EINVAL) {
> + if (ret = -EINVAL) {
> kvm_inject_gp(&svm->vcpu, 0);
> return 1;
> } else if (ret) {
I was hoping that my patch was OK and Paolo screwed it upon commit but
no, it's the same in my local branch and I'm left without excuses :-)
Reviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>
--
Vitaly
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] x86: KVM: svm: Fix a check in nested_svm_vmrun()
2019-08-27 9:38 [PATCH] x86: KVM: svm: Fix a check in nested_svm_vmrun() Dan Carpenter
2019-08-27 12:28 ` Vitaly Kuznetsov
@ 2019-08-27 13:39 ` Sean Christopherson
2019-09-11 15:28 ` Paolo Bonzini
2 siblings, 0 replies; 4+ messages in thread
From: Sean Christopherson @ 2019-08-27 13:39 UTC (permalink / raw)
To: Dan Carpenter
Cc: Paolo Bonzini, Vitaly Kuznetsov, Radim Krčmář,
Wanpeng Li, Jim Mattson, Joerg Roedel, Thomas Gleixner,
Ingo Molnar, Borislav Petkov, H. Peter Anvin, x86, kvm,
kernel-janitors
On Tue, Aug 27, 2019 at 12:38:52PM +0300, Dan Carpenter wrote:
> We refactored this code a bit and accidentally deleted the "-" character
> from "-EINVAL". The kvm_vcpu_map() function never returns positive
> EINVAL.
>
> Fixes: c8e16b78c614 ("x86: KVM: svm: eliminate hardcoded RIP advancement from vmrun_interception()")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
Reviewed-by: Sean Christopherson <sean.j.christopherson@intel.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] x86: KVM: svm: Fix a check in nested_svm_vmrun()
2019-08-27 9:38 [PATCH] x86: KVM: svm: Fix a check in nested_svm_vmrun() Dan Carpenter
2019-08-27 12:28 ` Vitaly Kuznetsov
2019-08-27 13:39 ` Sean Christopherson
@ 2019-09-11 15:28 ` Paolo Bonzini
2 siblings, 0 replies; 4+ messages in thread
From: Paolo Bonzini @ 2019-09-11 15:28 UTC (permalink / raw)
To: Dan Carpenter, Vitaly Kuznetsov
Cc: Radim Krčmář, Sean Christopherson, Wanpeng Li,
Jim Mattson, Joerg Roedel, Thomas Gleixner, Ingo Molnar,
Borislav Petkov, H. Peter Anvin, x86, kvm, kernel-janitors
On 27/08/19 11:38, Dan Carpenter wrote:
> We refactored this code a bit and accidentally deleted the "-" character
> from "-EINVAL". The kvm_vcpu_map() function never returns positive
> EINVAL.
>
> Fixes: c8e16b78c614 ("x86: KVM: svm: eliminate hardcoded RIP advancement from vmrun_interception()")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> From static analysis. I don't really know the impact.
>
>
> arch/x86/kvm/svm.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
> index 1f220a85514f..ef646e22d1ab 100644
> --- a/arch/x86/kvm/svm.c
> +++ b/arch/x86/kvm/svm.c
> @@ -3598,7 +3598,7 @@ static int nested_svm_vmrun(struct vcpu_svm *svm)
> vmcb_gpa = svm->vmcb->save.rax;
>
> ret = kvm_vcpu_map(&svm->vcpu, gpa_to_gfn(vmcb_gpa), &map);
> - if (ret = EINVAL) {
> + if (ret = -EINVAL) {
> kvm_inject_gp(&svm->vcpu, 0);
> return 1;
> } else if (ret) {
>
Queued, thanks.
Paolo
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-09-11 15:28 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-08-27 9:38 [PATCH] x86: KVM: svm: Fix a check in nested_svm_vmrun() Dan Carpenter
2019-08-27 12:28 ` Vitaly Kuznetsov
2019-08-27 13:39 ` Sean Christopherson
2019-09-11 15:28 ` Paolo Bonzini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).