All of lore.kernel.org
 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

* Re: [Qemu-devel] [PATCH] linux-user: Do not ignore mmap failure from host
  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
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Maydell @ 2013-07-02 14:19 UTC (permalink / raw)
  To: Jürg Billeter; +Cc: Riku Voipio, qemu-devel

On 29 June 2013 10:41, Jürg Billeter <j@bitron.ch> wrote:
> File mapping may fail with EACCES.
>
> Signed-off-by: Jürg Billeter <j@bitron.ch>

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

-- PMM

^ permalink raw reply	[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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.