]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
target/s390x/mmu_helper: Do not ignore address_space_rw() errors
authorPhilippe Mathieu-Daudé <philmd@linaro.org>
Wed, 8 Oct 2025 14:14:09 +0000 (16:14 +0200)
committerThomas Huth <thuth@redhat.com>
Thu, 16 Oct 2025 16:19:23 +0000 (18:19 +0200)
If a address_space_rw() call ever fails, break the loop and
return the PGM_ADDRESSING error (after triggering an access
exception).

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20251008141410.99865-3-philmd@linaro.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
target/s390x/mmu_helper.c

index 22d3d4a97dfd3bc29598b870a773f9ce020edbd2..3b1e75f78336c5ad9d67781c7a1cd13dffd60fa5 100644 (file)
@@ -546,9 +546,15 @@ int s390_cpu_virt_mem_rw(S390CPU *cpu, vaddr laddr, uint8_t ar, void *hostbuf,
 
         /* Copy data by stepping through the area page by page */
         for (i = 0; i < nr_pages; i++) {
+            MemTxResult res;
+
             currlen = MIN(len, TARGET_PAGE_SIZE - (laddr % TARGET_PAGE_SIZE));
-            address_space_rw(as, pages[i] | (laddr & ~TARGET_PAGE_MASK),
-                             attrs, hostbuf, currlen, is_write);
+            res = address_space_rw(as, pages[i] | (laddr & ~TARGET_PAGE_MASK),
+                                   attrs, hostbuf, currlen, is_write);
+            if (res != MEMTX_OK) {
+                ret = PGM_ADDRESSING;
+                break;
+            }
             laddr += currlen;
             hostbuf += currlen;
             len -= currlen;