From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50415) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zgv1f-0001Mo-F2 for qemu-devel@nongnu.org; Tue, 29 Sep 2015 09:33:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zgv1a-0003C6-H1 for qemu-devel@nongnu.org; Tue, 29 Sep 2015 09:32:59 -0400 Received: from lhrrgout.huawei.com ([194.213.3.17]:55490) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zgv1a-0003Bi-8X for qemu-devel@nongnu.org; Tue, 29 Sep 2015 09:32:54 -0400 References: <1443094669-4144-1-git-send-email-marcandre.lureau@redhat.com> <1443094669-4144-26-git-send-email-marcandre.lureau@redhat.com> From: Claudio Fontana Message-ID: <560A9301.8080701@huawei.com> Date: Tue, 29 Sep 2015 15:32:49 +0200 MIME-Version: 1.0 In-Reply-To: <1443094669-4144-26-git-send-email-marcandre.lureau@redhat.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH v4 25/47] ivshmem: check shm isn't already initialized List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: marcandre.lureau@redhat.com, qemu-devel@nongnu.org Cc: pbonzini@redhat.com, drjones@redhat.com, cam@cs.ualberta.ca, stefanha@redhat.com On 24.09.2015 13:37, marcandre.lureau@redhat.com wrote: > From: Marc-André Lureau > > The server should not change the shm, and this isn't handled by qemu. "..., and we should verify this in QEMU?" > > Signed-off-by: Marc-André Lureau > --- > hw/misc/ivshmem.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c > index ea80548..21ef260 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); > Reviewed-by: Claudio Fontana