]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
linux-user: Do not ignore mmap failure from host
authorJürg Billeter <j@bitron.ch>
Sat, 29 Jun 2013 09:41:32 +0000 (11:41 +0200)
committerRiku Voipio <riku.voipio@linaro.org>
Fri, 5 Jul 2013 12:45:40 +0000 (15:45 +0300)
File mapping may fail with EACCES.

Signed-off-by: Jürg Billeter <j@bitron.ch>
Message-id: 1372498892-23676-1-git-send-email-j@bitron.ch
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
linux-user/mmap.c

index b412e3fe0ae642d4b6b54232676da4c35339c615..de2219768dc66fa7e8d80b7a2035a32cad70690a 100644 (file)
@@ -483,6 +483,10 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int prot,
         if (!(flags & MAP_ANONYMOUS)) {
             p = mmap(g2h(start), len, prot,
                      flags | MAP_FIXED, fd, host_offset);
+            if (p == MAP_FAILED) {
+                munmap(g2h(start), host_len);
+                goto fail;
+            }
             host_start += offset - host_offset;
         }
         start = h2g(host_start);