diff options
author | Nicholas Piggin <npiggin@gmail.com> | 2017-08-13 04:33:38 +0300 |
---|---|---|
committer | Paul Mackerras <paulus@ozlabs.org> | 2017-08-31 05:36:44 +0300 |
commit | eaac112eac8604917bc6c39680ff67a937626a96 (patch) | |
tree | d009c92c25a88619dd8cf60367dc080754a9d312 /arch/powerpc/kvm | |
parent | d182b8fd6084412963cdb1a16d04c2f07234e82b (diff) | |
download | linux-eaac112eac8604917bc6c39680ff67a937626a96.tar.xz |
KVM: PPC: Book3S HV: Fix H_REGISTER_VPA VPA size validation
KVM currently validates the size of the VPA registered by the client
against sizeof(struct lppaca), however we align (and therefore size)
that struct to 1kB to avoid crossing a 4kB boundary in the client.
PAPR calls for sizes >= 640 bytes to be accepted. Hard code this with
a comment.
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
Diffstat (limited to 'arch/powerpc/kvm')
-rw-r--r-- | arch/powerpc/kvm/book3s_hv.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c index 359c79cdf0cc..1182cfd79857 100644 --- a/arch/powerpc/kvm/book3s_hv.c +++ b/arch/powerpc/kvm/book3s_hv.c @@ -485,7 +485,13 @@ static unsigned long do_h_register_vpa(struct kvm_vcpu *vcpu, switch (subfunc) { case H_VPA_REG_VPA: /* register VPA */ - if (len < sizeof(struct lppaca)) + /* + * The size of our lppaca is 1kB because of the way we align + * it for the guest to avoid crossing a 4kB boundary. We only + * use 640 bytes of the structure though, so we should accept + * clients that set a size of 640. + */ + if (len < 640) break; vpap = &tvcpu->arch.vpa; err = 0; |