From patchwork Tue Oct 6 19:19:21 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Patchwork-Id: 526942 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from eggs.gnu.org (eggs.gnu.org [IPv6:2001:4830:134:3::10]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id DFAB8140D89 for ; Wed, 7 Oct 2015 06:31:10 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=sbixa8/U; dkim-atps=neutral Received: from lists.gnu.org ([208.118.235.17]:54871) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZjXx6-0003dP-OQ for incoming@patchwork.ozlabs.org; Tue, 06 Oct 2015 15:31:08 -0400 Received: from localhost ([::1]:53383 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZjXx6-0007Ij-J6 for incoming@patchwork.ozlabs.org; Tue, 06 Oct 2015 15:31:08 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59260) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZjXo0-0001O2-D2 for qemu-devel@nongnu.org; Tue, 06 Oct 2015 15:22:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZjXna-0005M8-Mj for qemu-devel@nongnu.org; Tue, 06 Oct 2015 15:21:44 -0400 Received: from mail-qg0-x22d.google.com ([2607:f8b0:400d:c04::22d]:33409) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZjXnZ-0005ID-N2 for qemu-devel@nongnu.org; Tue, 06 Oct 2015 15:21:18 -0400 Received: by qgev79 with SMTP id v79so183484379qge.0 for ; Tue, 06 Oct 2015 12:21:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=xyC/qD9GeEY54W4qH4gY0FIGxSZYrJzAiIouGQgQlgE=; b=sbixa8/UxMnJ15PAYk66NbrUa23Ov4P5Q2U8KSeH56ss3Nvr+LHyBZTr4EeZ46EZDV cVGYrGcQbL5Ez/RnaaI3fudlDpBhKls1ly7z+SI0qhw3tmoT5lh0VUg70SvVtMXbGt0g XY5EtDHfpT3M9bqzwVtR1RtqcctbzZvwMKdeR50ABMeJstIUP0wkVQUpvzmdjabslR7K J+keN2IqL6GaCwZvdT43Gv2KoJdiDzJKlENll/qRJ7CvdejMCfmyUw2yv/ct3xwZKPGy ZBMdewcicFxLw+2fY88eEkKkOs0zM/v9AznoVYCWnlFAv1LdqoVYrUYEjTMrjTIZgXmr tQ8g== X-Received: by 10.140.108.102 with SMTP id i93mr48750366qgf.27.1444159277014; Tue, 06 Oct 2015 12:21:17 -0700 (PDT) Received: from localhost (bne75-h02-31-39-163-232.dsl.sta.abo.bbox.fr. [31.39.163.232]) by smtp.gmail.com with ESMTPSA id n6sm12529157qkh.25.2015.10.06.12.21.15 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Oct 2015 12:21:16 -0700 (PDT) From: marcandre.lureau@redhat.com To: peter.maydell@linaro.org Date: Tue, 6 Oct 2015 21:19:21 +0200 Message-Id: <1444159184-18153-26-git-send-email-marcandre.lureau@redhat.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1444159184-18153-1-git-send-email-marcandre.lureau@redhat.com> References: <1444159184-18153-1-git-send-email-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400d:c04::22d Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , qemu-devel@nongnu.org Subject: [Qemu-devel] [PULL 25/48] ivshmem: check shm isn't already initialized 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 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x From: Marc-André Lureau The server should not change the shm, and this isn't handled by qemu and we should should verify this in qemu. Signed-off-by: Marc-André Lureau Reviewed-by: Claudio Fontana --- hw/misc/ivshmem.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c index d3d0204..9023f95 100644 --- a/hw/misc/ivshmem.c +++ b/hw/misc/ivshmem.c @@ -533,6 +533,12 @@ static void ivshmem_read(void *opaque, const uint8_t *buf, int size) if (incoming_posn == -1) { void * map_ptr; + if (s->shm_fd >= 0) { + error_report("shm already initialized"); + close(incoming_fd); + return; + } + if (check_shm_size(s, incoming_fd, &err) == -1) { error_report_err(err); close(incoming_fd);