qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] linux-user: Do not ignore mmap failure from host


From: Jürg Billeter
Subject: [Qemu-devel] [PATCH] linux-user: Do not ignore mmap failure from host
Date: Sat, 29 Jun 2013 11:41:32 +0200

File mapping may fail with EACCES.

Signed-off-by: Jürg Billeter <address@hidden>
---
 linux-user/mmap.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/linux-user/mmap.c b/linux-user/mmap.c
index b412e3f..de22197 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);
-- 
1.8.2.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]