All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paul Mackerras <paulus@samba.org>
To: Alexander Graf <agraf@suse.de>
Cc: kvm@vger.kernel.org
Subject: [PATCH 7/8] KVM: PPC: Book3S HV: Allow DTL to be set to address 0, length 0
Date: Tue, 16 Oct 2012 14:06:30 +1100	[thread overview]
Message-ID: <20121016030630.GH1218@drongo> (raw)
In-Reply-To: <20121016030303.GA1218@drongo>

Commit 55b665b026 ("KVM: PPC: Book3S HV: Provide a way for userspace
to get/set per-vCPU areas") includes a check on the length of the
dispatch trace log (DTL) to make sure the buffer is at least one entry
long.  This is appropriate when registering a buffer, but the
interface also allows for any existing buffer to be unregistered by
specifying a zero address.  In this case the length check is not
appropriate.  This makes the check conditional on the address being
non-zero.

Signed-off-by: Paul Mackerras <paulus@samba.org>
---
 arch/powerpc/kvm/book3s_hv.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
index 8b3c470..812764c 100644
--- a/arch/powerpc/kvm/book3s_hv.c
+++ b/arch/powerpc/kvm/book3s_hv.c
@@ -811,9 +811,8 @@ int kvmppc_set_one_reg(struct kvm_vcpu *vcpu, u64 id, union kvmppc_one_reg *val)
 		addr = val->vpaval.addr;
 		len = val->vpaval.length;
 		r = -EINVAL;
-		if (len < sizeof(struct dtl_entry))
-			break;
-		if (addr && !vcpu->arch.vpa.next_gpa)
+		if (addr && (len < sizeof(struct dtl_entry) ||
+			     !vcpu->arch.vpa.next_gpa))
 			break;
 		len -= len % sizeof(struct dtl_entry);
 		r = set_vpa(vcpu, &vcpu->arch.dtl, addr, len);
-- 
1.7.10.4


  parent reply	other threads:[~2012-10-16  3:07 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-16  3:03 [PATCH 0/8] Various Book3s HV fixes that haven't been picked up yet Paul Mackerras
2012-10-16  3:03 ` [PATCH 1/8] KVM: PPC: Book3S HV: Allow KVM guests to stop secondary threads coming online Paul Mackerras
2012-10-16  3:04 ` [PATCH 2/8] KVM: PPC: Book3S HV: Fix some races in starting secondary threads Paul Mackerras
2012-10-16  3:04 ` [PATCH 3/8] KVM: PPC: Book3s HV: Don't access runnable threads list without vcore lock Paul Mackerras
2012-10-16  3:05 ` [PATCH 4/8] KVM: PPC: Book3S HV: Fixes for late-joining threads Paul Mackerras
2012-10-16  3:05 ` [PATCH 5/8] KVM: PPC: Book3S HV: Run virtual core whenever any vcpus in it can run Paul Mackerras
2012-10-16  3:06 ` [PATCH 6/8] KVM: PPC: Book3S HV: Fix accounting of stolen time Paul Mackerras
2012-10-16  3:06 ` Paul Mackerras [this message]
2012-10-16  3:07 ` [PATCH 8/8] KVM: PPC: Book3S HV: Fix thinko in try_lock_hpte() Paul Mackerras
  -- strict thread matches above, loose matches on Subject: below --
2012-10-15 11:18 [PATCH 7/8] KVM: PPC: Book3S HV: Allow DTL to be set to address 0, length 0 Paul Mackerras

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=20121016030630.GH1218@drongo \
    --to=paulus@samba.org \
    --cc=agraf@suse.de \
    --cc=kvm@vger.kernel.org \
    /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 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.