From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47740) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Usrhn-000590-5o for qemu-devel@nongnu.org; Sat, 29 Jun 2013 05:44:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Usrhk-0001xB-8g for qemu-devel@nongnu.org; Sat, 29 Jun 2013 05:44:31 -0400 Received: from cpanel09.rubas.ch ([195.182.222.79]:43342) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Usrhj-0001wo-Vh for qemu-devel@nongnu.org; Sat, 29 Jun 2013 05:44:28 -0400 From: =?UTF-8?q?J=C3=BCrg=20Billeter?= Date: Sat, 29 Jun 2013 11:41:32 +0200 Message-Id: <1372498892-23676-1-git-send-email-j@bitron.ch> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [Qemu-devel] [PATCH] linux-user: Do not ignore mmap failure from host List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: =?UTF-8?q?J=C3=BCrg=20Billeter?= , Riku Voipio File mapping may fail with EACCES. Signed-off-by: Jürg Billeter --- 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