qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL 0/1] Ivshmem fix
@ 2016-04-13 10:08 marcandre.lureau
  2016-04-13 10:08 ` [Qemu-devel] [PULL 1/1] ivshmem: fix ivshmem-{plain, doorbell} crash without arg marcandre.lureau
  2016-04-13 19:34 ` [Qemu-devel] [PULL 0/1] Ivshmem fix Peter Maydell
  0 siblings, 2 replies; 3+ messages in thread
From: marcandre.lureau @ 2016-04-13 10:08 UTC (permalink / raw)
  To: qemu-devel; +Cc: Marc-André Lureau

From: Marc-André Lureau <marcandre.lureau@redhat.com>

The following changes since commit d44122ecd0fa62d20762bdd8f214f077cb8e011b:

  Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging (2016-04-12 17:47:15 +0100)

are available in the git repository at:

  git@github.com:elmarco/qemu.git tags/ivshmem-fix-pull-request

for you to fetch changes up to 6dc64780c2a88307716649aa9232bcc129c1ab14:

  ivshmem: fix ivshmem-{plain,doorbell} crash without arg (2016-04-13 12:01:47 +0200)

----------------------------------------------------------------

----------------------------------------------------------------

Marc-André Lureau (1):
  ivshmem: fix ivshmem-{plain,doorbell} crash without arg

 hw/misc/ivshmem.c | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

-- 
2.5.5

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Qemu-devel] [PULL 1/1] ivshmem: fix ivshmem-{plain, doorbell} crash without arg
  2016-04-13 10:08 [Qemu-devel] [PULL 0/1] Ivshmem fix marcandre.lureau
@ 2016-04-13 10:08 ` marcandre.lureau
  2016-04-13 19:34 ` [Qemu-devel] [PULL 0/1] Ivshmem fix Peter Maydell
  1 sibling, 0 replies; 3+ messages in thread
From: marcandre.lureau @ 2016-04-13 10:08 UTC (permalink / raw)
  To: qemu-devel; +Cc: Marc-André Lureau

From: Marc-André Lureau <marcandre.lureau@redhat.com>

"qemu -device ivshmem-{plain,doorbell}" will crash, because the device
doesn't check that the required argument is provided. (screwed up in
commit 5400c02)

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
---
 hw/misc/ivshmem.c | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c
index 2eb8668..e40f23b 100644
--- a/hw/misc/ivshmem.c
+++ b/hw/misc/ivshmem.c
@@ -872,6 +872,8 @@ static void ivshmem_common_realize(PCIDevice *dev, Error **errp)
         s->ivshmem_bar2 = host_memory_backend_get_memory(s->hostmem,
                                                          &error_abort);
     } else {
+        assert(s->server_chr);
+
         IVSHMEM_DPRINTF("using shared memory server (socket = %s)\n",
                         s->server_chr->filename);
 
@@ -1051,10 +1053,24 @@ static void ivshmem_plain_init(Object *obj)
                              &error_abort);
 }
 
+static void ivshmem_plain_realize(PCIDevice *dev, Error **errp)
+{
+    IVShmemState *s = IVSHMEM_COMMON(dev);
+
+    if (!s->hostmem) {
+        error_setg(errp, "You must specify a 'memdev'");
+        return;
+    }
+
+    ivshmem_common_realize(dev, errp);
+}
+
 static void ivshmem_plain_class_init(ObjectClass *klass, void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
+    PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
 
+    k->realize = ivshmem_plain_realize;
     dc->props = ivshmem_plain_properties;
     dc->vmsd = &ivshmem_plain_vmsd;
 }
@@ -1099,10 +1115,24 @@ static void ivshmem_doorbell_init(Object *obj)
     s->legacy_size = SIZE_MAX;  /* whatever the server sends */
 }
 
+static void ivshmem_doorbell_realize(PCIDevice *dev, Error **errp)
+{
+    IVShmemState *s = IVSHMEM_COMMON(dev);
+
+    if (!s->server_chr) {
+        error_setg(errp, "You must specify a 'chardev'");
+        return;
+    }
+
+    ivshmem_common_realize(dev, errp);
+}
+
 static void ivshmem_doorbell_class_init(ObjectClass *klass, void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
+    PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
 
+    k->realize = ivshmem_doorbell_realize;
     dc->props = ivshmem_doorbell_properties;
     dc->vmsd = &ivshmem_doorbell_vmsd;
 }
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PULL 0/1] Ivshmem fix
  2016-04-13 10:08 [Qemu-devel] [PULL 0/1] Ivshmem fix marcandre.lureau
  2016-04-13 10:08 ` [Qemu-devel] [PULL 1/1] ivshmem: fix ivshmem-{plain, doorbell} crash without arg marcandre.lureau
@ 2016-04-13 19:34 ` Peter Maydell
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Maydell @ 2016-04-13 19:34 UTC (permalink / raw)
  To: Marc-André Lureau; +Cc: QEMU Developers

On 13 April 2016 at 11:08,  <marcandre.lureau@redhat.com> wrote:
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
>
> The following changes since commit d44122ecd0fa62d20762bdd8f214f077cb8e011b:
>
>   Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging (2016-04-12 17:47:15 +0100)
>
> are available in the git repository at:
>
>   git@github.com:elmarco/qemu.git tags/ivshmem-fix-pull-request
>
> for you to fetch changes up to 6dc64780c2a88307716649aa9232bcc129c1ab14:
>
>   ivshmem: fix ivshmem-{plain,doorbell} crash without arg (2016-04-13 12:01:47 +0200)
>
> ----------------------------------------------------------------
>
> ----------------------------------------------------------------
>
> Marc-André Lureau (1):
>   ivshmem: fix ivshmem-{plain,doorbell} crash without arg
>
>  hw/misc/ivshmem.c | 30 ++++++++++++++++++++++++++++++
>  1 file changed, 30 insertions(+)

Applied, thanks.

-- PMM

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-04-13 19:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-13 10:08 [Qemu-devel] [PULL 0/1] Ivshmem fix marcandre.lureau
2016-04-13 10:08 ` [Qemu-devel] [PULL 1/1] ivshmem: fix ivshmem-{plain, doorbell} crash without arg marcandre.lureau
2016-04-13 19:34 ` [Qemu-devel] [PULL 0/1] Ivshmem fix Peter Maydell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).