]> xenbits.xensource.com Git - qemu-xen-unstable.git/commitdiff
s390x: sclp: boundary check
authorJanosch Frank <frankja@linux.ibm.com>
Fri, 27 Sep 2019 13:33:21 +0000 (15:33 +0200)
committerChristian Borntraeger <borntraeger@de.ibm.com>
Mon, 30 Sep 2019 11:51:50 +0000 (13:51 +0200)
All sclp codes need to be checked for page boundary violations.

Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
Reviewed-by: Jason J. Herne <jjherne@linux.ibm.com>
Message-Id: <1569591203-15258-3-git-send-email-imbrenda@linux.ibm.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
hw/s390x/sclp.c

index 95ebfe7bd2f10fd3613a9e6483e41903812891de..73244c938b10068438317275d62fc9ce2e682748 100644 (file)
@@ -234,6 +234,11 @@ int sclp_service_call(CPUS390XState *env, uint64_t sccb, uint32_t code)
         goto out_write;
     }
 
+    if ((sccb + be16_to_cpu(work_sccb.h.length)) > ((sccb & PAGE_MASK) + PAGE_SIZE)) {
+        work_sccb.h.response_code = cpu_to_be16(SCLP_RC_SCCB_BOUNDARY_VIOLATION);
+        goto out_write;
+    }
+
     sclp_c->execute(sclp, &work_sccb, code);
 out_write:
     cpu_physical_memory_write(sccb, &work_sccb,