Skip to content

Commit df98923

Browse files
schlacClaudio Imbrenda
authored andcommitted
KVM: s390: Reject setting flic pfault attributes on ucontrol VMs
Prevent null pointer dereference when processing the KVM_DEV_FLIC_APF_ENABLE and KVM_DEV_FLIC_APF_DISABLE_WAIT ioctls in the interrupt controller. Fixes: 3c038e6 ("KVM: async_pf: Async page fault support on s390") Reported-by: Claudio Imbrenda <imbrenda@linux.ibm.com> Signed-off-by: Christoph Schlameuss <schlameuss@linux.ibm.com> Reviewed-by: Hariharan Mari <hari55@linux.ibm.com> Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com> Link: https://lore.kernel.org/r/20241216092140.329196-2-schlameuss@linux.ibm.com Message-ID: <20241216092140.329196-2-schlameuss@linux.ibm.com> Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
1 parent 984aaf6 commit df98923

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

Documentation/virt/kvm/devices/s390_flic.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,15 @@ Groups:
5858
Enables async page faults for the guest. So in case of a major page fault
5959
the host is allowed to handle this async and continues the guest.
6060

61+
-EINVAL is returned when called on the FLIC of a ucontrol VM.
62+
6163
KVM_DEV_FLIC_APF_DISABLE_WAIT
6264
Disables async page faults for the guest and waits until already pending
6365
async page faults are done. This is necessary to trigger a completion interrupt
6466
for every init interrupt before migrating the interrupt list.
6567

68+
-EINVAL is returned when called on the FLIC of a ucontrol VM.
69+
6670
KVM_DEV_FLIC_ADAPTER_REGISTER
6771
Register an I/O adapter interrupt source. Takes a kvm_s390_io_adapter
6872
describing the adapter to register::

arch/s390/kvm/interrupt.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2678,9 +2678,13 @@ static int flic_set_attr(struct kvm_device *dev, struct kvm_device_attr *attr)
26782678
kvm_s390_clear_float_irqs(dev->kvm);
26792679
break;
26802680
case KVM_DEV_FLIC_APF_ENABLE:
2681+
if (kvm_is_ucontrol(dev->kvm))
2682+
return -EINVAL;
26812683
dev->kvm->arch.gmap->pfault_enabled = 1;
26822684
break;
26832685
case KVM_DEV_FLIC_APF_DISABLE_WAIT:
2686+
if (kvm_is_ucontrol(dev->kvm))
2687+
return -EINVAL;
26842688
dev->kvm->arch.gmap->pfault_enabled = 0;
26852689
/*
26862690
* Make sure no async faults are in transition when

0 commit comments

Comments
 (0)