summaryrefslogtreecommitdiff
path: root/arch/s390/kvm/interrupt.c
diff options
context:
space:
mode:
authorMichael Mueller <mimu@linux.ibm.com>2019-01-31 11:52:46 +0300
committerChristian Borntraeger <borntraeger@de.ibm.com>2019-02-05 16:29:24 +0300
commitb9fa6d6ee9b88eedf2d2261f931841664aa6980e (patch)
treec3bda67defed0fa228f2b7ffe0b0ca18ff7dce63 /arch/s390/kvm/interrupt.c
parentb1d1e76ed9ee5a0f7671da257d4f0595d1f5162e (diff)
downloadlinux-b9fa6d6ee9b88eedf2d2261f931841664aa6980e.tar.xz
KVM: s390: fix possible null pointer dereference in pending_irqs()
Assure a GISA is in use before accessing the IPM to avoid a null pointer dereference issue. Signed-off-by: Michael Mueller <mimu@linux.ibm.com> Reported-by: Halil Pasic <pasic@linux.ibm.com> Reviewed-by: Pierre Morel <pmorel@linux.ibm.com> Reviewed-by: Cornelia Huck <cohuck@redhat.com> Message-Id: <20190131085247.13826-16-mimu@linux.ibm.com> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Diffstat (limited to 'arch/s390/kvm/interrupt.c')
-rw-r--r--arch/s390/kvm/interrupt.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/arch/s390/kvm/interrupt.c b/arch/s390/kvm/interrupt.c
index dc446203e5a4..82162867f378 100644
--- a/arch/s390/kvm/interrupt.c
+++ b/arch/s390/kvm/interrupt.c
@@ -329,9 +329,13 @@ static inline unsigned long pending_irqs_no_gisa(struct kvm_vcpu *vcpu)
static inline unsigned long pending_irqs(struct kvm_vcpu *vcpu)
{
- return pending_irqs_no_gisa(vcpu) |
- gisa_get_ipm(vcpu->kvm->arch.gisa_int.origin) <<
- IRQ_PEND_IO_ISC_7;
+ struct kvm_s390_gisa_interrupt *gi = &vcpu->kvm->arch.gisa_int;
+ unsigned long pending_mask;
+
+ pending_mask = pending_irqs_no_gisa(vcpu);
+ if (gi->origin)
+ pending_mask |= gisa_get_ipm(gi->origin) << IRQ_PEND_IO_ISC_7;
+ return pending_mask;
}
static inline int isc_to_irq_type(unsigned long isc)