From patchwork Wed Jul 10 10:20:50 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 258007 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id D9E7A2C0095 for ; Wed, 10 Jul 2013 20:25:09 +1000 (EST) Received: from localhost ([::1]:34043 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uwra7-0006KT-LJ for incoming@patchwork.ozlabs.org; Wed, 10 Jul 2013 06:25:07 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39697) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UwrWM-0000bu-TU for qemu-devel@nongnu.org; Wed, 10 Jul 2013 06:21:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UwrW7-00009h-0s for qemu-devel@nongnu.org; Wed, 10 Jul 2013 06:21:14 -0400 Received: from afflict.kos.to ([92.243.29.197]:38819) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UwrW6-00009U-Ok for qemu-devel@nongnu.org; Wed, 10 Jul 2013 06:20:58 -0400 Received: from kos.to (unknown [193.120.41.118]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by afflict.kos.to (Postfix) with ESMTPSA id 2186C26553 for ; Wed, 10 Jul 2013 12:20:58 +0200 (CEST) Received: from voipio (uid 1000) (envelope-from voipio@kos.to) id 5e06f6 by kos.to (DragonFly Mail Agent); Wed, 10 Jul 2013 13:20:52 +0300 From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Wed, 10 Jul 2013 13:20:50 +0300 Message-Id: <8384274eda1d7cb01f326143fa6118562c1eb5be.1373051589.git.riku.voipio@linaro.org> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: References: MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 92.243.29.197 Cc: =?UTF-8?q?J=C3=BCrg=20Billeter?= Subject: [Qemu-devel] [PATCH 7/7] linux-user: Do not ignore mmap failure from host X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Jürg Billeter File mapping may fail with EACCES. Signed-off-by: Jürg Billeter Message-id: 1372498892-23676-1-git-send-email-j@bitron.ch Reviewed-by: Peter Maydell --- 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);