linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Nicholas Krause <xerofoify@gmail.com>, gleb@kernel.org
Cc: x86@kernel.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] x86:kvm:Fix error handling in the function kvm_lapic_sync_from_vapic
Date: Wed, 5 Aug 2015 16:54:58 +0200	[thread overview]
Message-ID: <55C223C2.6040701@redhat.com> (raw)
In-Reply-To: <1438785880-25434-1-git-send-email-xerofoify@gmail.com>



On 05/08/2015 16:44, Nicholas Krause wrote:
> This fixes error handling in the function kvm_lapic_sync_from_vapic
> by checking if the call to kvm_read_guest_cached has returned a
> error code to signal to its caller the call to this function has
> failed and due to this we must immediately return to the caller
> of kvm_lapic_sync_from_vapic to avoid incorrectly call apic_set_tpc
> if a error has occurred here.
> 
> Signed-off-by: Nicholas Krause <xerofoify@gmail.com>
> ---
>  arch/x86/kvm/lapic.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
> index 2a5ca97..9a3e342 100644
> --- a/arch/x86/kvm/lapic.c
> +++ b/arch/x86/kvm/lapic.c
> @@ -1900,8 +1900,9 @@ void kvm_lapic_sync_from_vapic(struct kvm_vcpu *vcpu)
>  	if (!test_bit(KVM_APIC_CHECK_VAPIC, &vcpu->arch.apic_attention))
>  		return;
>  
> -	kvm_read_guest_cached(vcpu->kvm, &vcpu->arch.apic->vapic_cache, &data,
> -				sizeof(u32));
> +	if (kvm_read_guest_cached(vcpu->kvm, &vcpu->arch.apic->vapic_cache, &data,
> +				  sizeof(u32)))
> +		return;
>  
>  	apic_set_tpr(vcpu->arch.apic, data & 0xff);
>  }
> 

Congratulations, this patch is good! :)

I'm applying it to kvm.git's queue branch.

Paolo

           reply	other threads:[~2015-08-05 14:55 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <1438785880-25434-1-git-send-email-xerofoify@gmail.com>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55C223C2.6040701@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=gleb@kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=x86@kernel.org \
    --cc=xerofoify@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).