Skip to contentSkip to conversation

linux-user: Do not ignore mmap failure from host

PATCH In review Jürg Billeter 2 participants 2 messages Jun 29, 2013 – Jul 2, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 linux-user: Do not ignore mmap failure from host

File mapping may fail with EACCES.

---
 linux-user/mmap.c | 4 ++++
 1 file changed, 4 insertions(+)
linux-user/mmap.c +4 -0
index b412e3f..de22197 100644
@@ -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);
Signature · 1 line
1.8.2.3