diff options
Diffstat (limited to 'arch/s390/kvm/sigp.c')
-rw-r--r-- | arch/s390/kvm/sigp.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/arch/s390/kvm/sigp.c b/arch/s390/kvm/sigp.c index 26caeb530a78..c0b99e0f6b63 100644 --- a/arch/s390/kvm/sigp.c +++ b/arch/s390/kvm/sigp.c | |||
@@ -235,7 +235,6 @@ static int __sigp_set_prefix(struct kvm_vcpu *vcpu, u16 cpu_addr, u32 address, | |||
235 | struct kvm_vcpu *dst_vcpu = NULL; | 235 | struct kvm_vcpu *dst_vcpu = NULL; |
236 | struct kvm_s390_interrupt_info *inti; | 236 | struct kvm_s390_interrupt_info *inti; |
237 | int rc; | 237 | int rc; |
238 | u8 tmp; | ||
239 | 238 | ||
240 | if (cpu_addr < KVM_MAX_VCPUS) | 239 | if (cpu_addr < KVM_MAX_VCPUS) |
241 | dst_vcpu = kvm_get_vcpu(vcpu->kvm, cpu_addr); | 240 | dst_vcpu = kvm_get_vcpu(vcpu->kvm, cpu_addr); |
@@ -243,10 +242,13 @@ static int __sigp_set_prefix(struct kvm_vcpu *vcpu, u16 cpu_addr, u32 address, | |||
243 | return SIGP_CC_NOT_OPERATIONAL; | 242 | return SIGP_CC_NOT_OPERATIONAL; |
244 | li = &dst_vcpu->arch.local_int; | 243 | li = &dst_vcpu->arch.local_int; |
245 | 244 | ||
246 | /* make sure that the new value is valid memory */ | 245 | /* |
247 | address = address & 0x7fffe000u; | 246 | * Make sure the new value is valid memory. We only need to check the |
248 | if (copy_from_guest_absolute(vcpu, &tmp, address, 1) || | 247 | * first page, since address is 8k aligned and memory pieces are always |
249 | copy_from_guest_absolute(vcpu, &tmp, address + PAGE_SIZE, 1)) { | 248 | * at least 1MB aligned and have at least a size of 1MB. |
249 | */ | ||
250 | address &= 0x7fffe000u; | ||
251 | if (kvm_is_error_gpa(vcpu->kvm, address)) { | ||
250 | *reg &= 0xffffffff00000000UL; | 252 | *reg &= 0xffffffff00000000UL; |
251 | *reg |= SIGP_STATUS_INVALID_PARAMETER; | 253 | *reg |= SIGP_STATUS_INVALID_PARAMETER; |
252 | return SIGP_CC_STATUS_STORED; | 254 | return SIGP_CC_STATUS_STORED; |