From patchwork Fri Oct 2 19:09:28 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: 525762 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)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 76CCE140D79 for ; Sat, 3 Oct 2015 05:39:34 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=h26Oh+JX; dkim-atps=neutral Received: from localhost ([::1]:34741 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zi6B2-0000ej-AD for incoming@patchwork.ozlabs.org; Fri, 02 Oct 2015 15:39:32 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34184) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zi5j9-0007cc-NS for qemu-devel@nongnu.org; Fri, 02 Oct 2015 15:10:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zi5j5-0007kG-0z for qemu-devel@nongnu.org; Fri, 02 Oct 2015 15:10:43 -0400 Received: from mail-wi0-x232.google.com ([2a00:1450:400c:c05::232]:38615) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zi5j4-0007jL-NO for qemu-devel@nongnu.org; Fri, 02 Oct 2015 15:10:38 -0400 Received: by wiclk2 with SMTP id lk2so43245508wic.1 for ; Fri, 02 Oct 2015 12:10:38 -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=h26Oh+JXUKPN6YOm97HVRdsapyWHHiuBoDzuxN0WocBX4ecW8fYRHe1T21mzxPwJQI bX9xkXf0p+JvvxiPCFYaffc8iNOwD14SbRdd1hIC5y1u2c0JtBdXq2ECDUR7ZvKTEfK0 DG6cNQRXpLGiGbdrQSN+QcOcNT/jvp8h72XiyWfuso97cJ+8JHDri9wvWifrR+aLpq6K 96h8CptEVPtr5v64KUTNvHD/vcenBScwmYNxQXzlzAdG/EYmxNyB/fViaVtOQfiuV158 15Lpw7kbELIOeoLMvtVD1q6qnhFcBxUzVi5vu6bjsqHGNrz92D3SOZ7ta2iwZ19uoGr0 JtLw== X-Received: by 10.194.246.161 with SMTP id xx1mr17777901wjc.26.1443813038214; Fri, 02 Oct 2015 12:10:38 -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 qq4sm12693335wjc.14.2015.10.02.12.10.37 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 02 Oct 2015 12:10:37 -0700 (PDT) From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Date: Fri, 2 Oct 2015 21:09:28 +0200 Message-Id: <1443812991-17356-26-git-send-email-marcandre.lureau@redhat.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1443812991-17356-1-git-send-email-marcandre.lureau@redhat.com> References: <1443812991-17356-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: 2a00:1450:400c:c05::232 Cc: drjones@redhat.com, claudio.fontana@huawei.com, stefanha@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , pbonzini@redhat.com, cam@cs.ualberta.ca Subject: [Qemu-devel] [PATCH v5 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 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);