aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2013-06-29 11:41:32 +0200
committerPeter Maydell <peter.maydell@linaro.org>2013-07-02 14:56:18 +0100
commitb35e455fac7d3cb40e09a218665c6a654cc9eaff (patch)
treeb36a18f453f02a1b022dbb646cb56f0eb465e25e
parent177130fadfad04cf0a68ee2324a46a8b8df03a65 (diff)
downloadqemu-arm-linux-user.next.tar.gz
linux-user: Do not ignore mmap failure from hostlinux-user.next
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>
-rw-r--r--linux-user/mmap.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/linux-user/mmap.c b/linux-user/mmap.c
index b412e3fe0a..de2219768d 100644
--- a/linux-user/mmap.c
+++ b/linux-user/mmap.c
@@ -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);