Skip to content

Commit 5021fd7

Browse files
schlacClaudio Imbrenda
authored andcommitted
KVM: s390: Reject KVM_SET_GSI_ROUTING on ucontrol VMs
Prevent null pointer dereference when processing KVM_IRQ_ROUTING_S390_ADAPTER routing entries. The ioctl cannot be processed for ucontrol VMs. Fixes: f654706 ("KVM: s390/interrupt: do not pin adapter interrupt pages") Signed-off-by: Christoph Schlameuss <schlameuss@linux.ibm.com> Tested-by: Hariharan Mari <hari55@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-4-schlameuss@linux.ibm.com Message-ID: <20241216092140.329196-4-schlameuss@linux.ibm.com> Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
1 parent b07f6a3 commit 5021fd7

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

Documentation/virt/kvm/api.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1914,6 +1914,9 @@ No flags are specified so far, the corresponding field must be set to zero.
19141914
#define KVM_IRQ_ROUTING_HV_SINT 4
19151915
#define KVM_IRQ_ROUTING_XEN_EVTCHN 5
19161916

1917+
On s390, adding a KVM_IRQ_ROUTING_S390_ADAPTER is rejected on ucontrol VMs with
1918+
error -EINVAL.
1919+
19171920
flags:
19181921

19191922
- KVM_MSI_VALID_DEVID: used along with KVM_IRQ_ROUTING_MSI routing entry

arch/s390/kvm/interrupt.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2898,6 +2898,8 @@ int kvm_set_routing_entry(struct kvm *kvm,
28982898
switch (ue->type) {
28992899
/* we store the userspace addresses instead of the guest addresses */
29002900
case KVM_IRQ_ROUTING_S390_ADAPTER:
2901+
if (kvm_is_ucontrol(kvm))
2902+
return -EINVAL;
29012903
e->set = set_adapter_int;
29022904
uaddr = gmap_translate(kvm->arch.gmap, ue->u.adapter.summary_addr);
29032905
if (uaddr == -EFAULT)

0 commit comments

Comments
 (0)