diff options
author | Avi Kivity <avi@redhat.com> | 2010-05-13 05:30:43 -0400 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2010-08-01 03:35:48 -0400 |
commit | 19483d144023f7f4817dedafe26d5fe9ff2e7087 (patch) | |
tree | 5d0979cc9668a2554be05a399a94ff01c597afca /arch/powerpc/kvm/powerpc.c | |
parent | bc923cc93b7719576f20687e4cb07751601fbbb3 (diff) |
KVM: PPC: Centralize locking of arch specific vcpu ioctls
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/powerpc/kvm/powerpc.c')
-rw-r--r-- | arch/powerpc/kvm/powerpc.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c index e0fae7a618ca..caeed7b31bf9 100644 --- a/arch/powerpc/kvm/powerpc.c +++ b/arch/powerpc/kvm/powerpc.c | |||
@@ -512,15 +512,17 @@ long kvm_arch_vcpu_ioctl(struct file *filp, | |||
512 | void __user *argp = (void __user *)arg; | 512 | void __user *argp = (void __user *)arg; |
513 | long r; | 513 | long r; |
514 | 514 | ||
515 | switch (ioctl) { | 515 | if (ioctl == KVM_INTERRUPT) { |
516 | case KVM_INTERRUPT: { | ||
517 | struct kvm_interrupt irq; | 516 | struct kvm_interrupt irq; |
518 | r = -EFAULT; | 517 | r = -EFAULT; |
519 | if (copy_from_user(&irq, argp, sizeof(irq))) | 518 | if (copy_from_user(&irq, argp, sizeof(irq))) |
520 | goto out; | 519 | goto out_nolock; |
521 | r = kvm_vcpu_ioctl_interrupt(vcpu, &irq); | 520 | r = kvm_vcpu_ioctl_interrupt(vcpu, &irq); |
522 | break; | 521 | goto out_nolock; |
523 | } | 522 | } |
523 | |||
524 | vcpu_load(vcpu); | ||
525 | switch (ioctl) { | ||
524 | case KVM_ENABLE_CAP: | 526 | case KVM_ENABLE_CAP: |
525 | { | 527 | { |
526 | struct kvm_enable_cap cap; | 528 | struct kvm_enable_cap cap; |
@@ -535,6 +537,8 @@ long kvm_arch_vcpu_ioctl(struct file *filp, | |||
535 | } | 537 | } |
536 | 538 | ||
537 | out: | 539 | out: |
540 | vcpu_put(vcpu); | ||
541 | out_nolock: | ||
538 | return r; | 542 | return r; |
539 | } | 543 | } |
540 | 544 | ||