qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] linux-user: Do not ignore mmap failure from host
@ 2013-06-29  9:41 Jürg Billeter
  2013-07-02 14:19 ` Peter Maydell
  0 siblings, 1 reply; 2+ messages in thread
From: Jürg Billeter @ 2013-06-29  9:41 UTC (permalink / raw)
  To: qemu-devel; +Cc: Jürg Billeter, Riku Voipio

File mapping may fail with EACCES.

Signed-off-by: Jürg Billeter <j@bitron.ch>
---
 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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-07-02 14:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-29  9:41 [Qemu-devel] [PATCH] linux-user: Do not ignore mmap failure from host Jürg Billeter
2013-07-02 14:19 ` Peter Maydell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).