qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2] virtio-rng: Fix crash with non-default backend
@ 2013-05-31 18:12 Cole Robinson
  2013-06-03  7:02 ` Amit Shah
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Cole Robinson @ 2013-05-31 18:12 UTC (permalink / raw)
  To: qemu-devel; +Cc: amit.shah, Cole Robinson, fred.konrad, qemu-stable, mst

'default_backend' isn't always set, but 'rng' is, so use that.

$ ./x86_64-softmmu/qemu-system-x86_64 -object rng-random,id=rng0,filename=/dev/random -device virtio-rng-pci,rng=rng0
Segmentation fault (core dumped)

Regressed with virtio refactoring in 59ccd20a9ac719cff82180429458728f03ec612f

CC: qemu-stable@nongnu.org
Signed-off-by: Cole Robinson <crobinso@redhat.com>
---

Notes:
    v2: Fix other instances in s390x code, pointed out by Frederic

 hw/s390x/s390-virtio-bus.c | 2 +-
 hw/s390x/virtio-ccw.c      | 2 +-
 hw/virtio/virtio-pci.c     | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/hw/s390x/s390-virtio-bus.c b/hw/s390x/s390-virtio-bus.c
index a1cdfb0..207eb82 100644
--- a/hw/s390x/s390-virtio-bus.c
+++ b/hw/s390x/s390-virtio-bus.c
@@ -300,7 +300,7 @@ static int s390_virtio_rng_init(VirtIOS390Device *s390_dev)
     }
 
     object_property_set_link(OBJECT(dev),
-                             OBJECT(dev->vdev.conf.default_backend), "rng",
+                             OBJECT(dev->vdev.conf.rng), "rng",
                              NULL);
 
     return s390_virtio_device_init(s390_dev, VIRTIO_DEVICE(vdev));
diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c
index 5f5e267..7dcd98d 100644
--- a/hw/s390x/virtio-ccw.c
+++ b/hw/s390x/virtio-ccw.c
@@ -744,7 +744,7 @@ static int virtio_ccw_rng_init(VirtioCcwDevice *ccw_dev)
     }
 
     object_property_set_link(OBJECT(dev),
-                             OBJECT(dev->vdev.conf.default_backend), "rng",
+                             OBJECT(dev->vdev.conf.rng), "rng",
                              NULL);
 
     return virtio_ccw_device_init(ccw_dev, VIRTIO_DEVICE(vdev));
diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c
index 444b71a..b070b64 100644
--- a/hw/virtio/virtio-pci.c
+++ b/hw/virtio/virtio-pci.c
@@ -1455,7 +1455,7 @@ static int virtio_rng_pci_init(VirtIOPCIProxy *vpci_dev)
     }
 
     object_property_set_link(OBJECT(vrng),
-                             OBJECT(vrng->vdev.conf.default_backend), "rng",
+                             OBJECT(vrng->vdev.conf.rng), "rng",
                              NULL);
 
     return 0;
-- 
1.8.2.1

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

* Re: [Qemu-devel] [PATCH v2] virtio-rng: Fix crash with non-default backend
  2013-05-31 18:12 [Qemu-devel] [PATCH v2] virtio-rng: Fix crash with non-default backend Cole Robinson
@ 2013-06-03  7:02 ` Amit Shah
  2013-06-03 12:12 ` Michael S. Tsirkin
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Amit Shah @ 2013-06-03  7:02 UTC (permalink / raw)
  To: Cole Robinson; +Cc: qemu-stable, fred.konrad, qemu-devel, mst

On (Fri) 31 May 2013 [14:12:48], Cole Robinson wrote:
> 'default_backend' isn't always set, but 'rng' is, so use that.
> 
> $ ./x86_64-softmmu/qemu-system-x86_64 -object rng-random,id=rng0,filename=/dev/random -device virtio-rng-pci,rng=rng0
> Segmentation fault (core dumped)
> 
> Regressed with virtio refactoring in 59ccd20a9ac719cff82180429458728f03ec612f
> 
> CC: qemu-stable@nongnu.org
> Signed-off-by: Cole Robinson <crobinso@redhat.com>
> ---
> 
> Notes:
>     v2: Fix other instances in s390x code, pointed out by Frederic

Acked-by: Amit Shah <amit.shah@redhat.com>

		Amit

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

* Re: [Qemu-devel] [PATCH v2] virtio-rng: Fix crash with non-default backend
  2013-05-31 18:12 [Qemu-devel] [PATCH v2] virtio-rng: Fix crash with non-default backend Cole Robinson
  2013-06-03  7:02 ` Amit Shah
@ 2013-06-03 12:12 ` Michael S. Tsirkin
  2013-06-12 20:33 ` mdroth
  2013-06-21 15:34 ` Anthony Liguori
  3 siblings, 0 replies; 5+ messages in thread
From: Michael S. Tsirkin @ 2013-06-03 12:12 UTC (permalink / raw)
  To: Cole Robinson; +Cc: amit.shah, qemu-stable, qemu-devel, fred.konrad

On Fri, May 31, 2013 at 02:12:48PM -0400, Cole Robinson wrote:
> 'default_backend' isn't always set, but 'rng' is, so use that.
> 
> $ ./x86_64-softmmu/qemu-system-x86_64 -object rng-random,id=rng0,filename=/dev/random -device virtio-rng-pci,rng=rng0
> Segmentation fault (core dumped)
> 
> Regressed with virtio refactoring in 59ccd20a9ac719cff82180429458728f03ec612f
> 
> CC: qemu-stable@nongnu.org
> Signed-off-by: Cole Robinson <crobinso@redhat.com>

Acked-by: Michael S. Tsirkin <mst@redhat.com>

An unrelated comment:
we have many instances if the literal "rng"
string in code. They all must match otherwise
things crash.

So why not add a macro

#define VIRTIO_RNG_BACKEND_LINK "rng"

this way compiler checks that we don't make any typos.

> ---
> 
> Notes:
>     v2: Fix other instances in s390x code, pointed out by Frederic
> 
>  hw/s390x/s390-virtio-bus.c | 2 +-
>  hw/s390x/virtio-ccw.c      | 2 +-
>  hw/virtio/virtio-pci.c     | 2 +-
>  3 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/hw/s390x/s390-virtio-bus.c b/hw/s390x/s390-virtio-bus.c
> index a1cdfb0..207eb82 100644
> --- a/hw/s390x/s390-virtio-bus.c
> +++ b/hw/s390x/s390-virtio-bus.c
> @@ -300,7 +300,7 @@ static int s390_virtio_rng_init(VirtIOS390Device *s390_dev)
>      }
>  
>      object_property_set_link(OBJECT(dev),
> -                             OBJECT(dev->vdev.conf.default_backend), "rng",
> +                             OBJECT(dev->vdev.conf.rng), "rng",
>                               NULL);
>  
>      return s390_virtio_device_init(s390_dev, VIRTIO_DEVICE(vdev));
> diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c
> index 5f5e267..7dcd98d 100644
> --- a/hw/s390x/virtio-ccw.c
> +++ b/hw/s390x/virtio-ccw.c
> @@ -744,7 +744,7 @@ static int virtio_ccw_rng_init(VirtioCcwDevice *ccw_dev)
>      }
>  
>      object_property_set_link(OBJECT(dev),
> -                             OBJECT(dev->vdev.conf.default_backend), "rng",
> +                             OBJECT(dev->vdev.conf.rng), "rng",
>                               NULL);
>  
>      return virtio_ccw_device_init(ccw_dev, VIRTIO_DEVICE(vdev));
> diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c
> index 444b71a..b070b64 100644
> --- a/hw/virtio/virtio-pci.c
> +++ b/hw/virtio/virtio-pci.c
> @@ -1455,7 +1455,7 @@ static int virtio_rng_pci_init(VirtIOPCIProxy *vpci_dev)
>      }
>  
>      object_property_set_link(OBJECT(vrng),
> -                             OBJECT(vrng->vdev.conf.default_backend), "rng",
> +                             OBJECT(vrng->vdev.conf.rng), "rng",
>                               NULL);
>  
>      return 0;
> -- 
> 1.8.2.1

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

* Re: [Qemu-devel] [PATCH v2] virtio-rng: Fix crash with non-default backend
  2013-05-31 18:12 [Qemu-devel] [PATCH v2] virtio-rng: Fix crash with non-default backend Cole Robinson
  2013-06-03  7:02 ` Amit Shah
  2013-06-03 12:12 ` Michael S. Tsirkin
@ 2013-06-12 20:33 ` mdroth
  2013-06-21 15:34 ` Anthony Liguori
  3 siblings, 0 replies; 5+ messages in thread
From: mdroth @ 2013-06-12 20:33 UTC (permalink / raw)
  To: Cole Robinson; +Cc: amit.shah, qemu-stable, mst, qemu-devel, fred.konrad

On Fri, May 31, 2013 at 02:12:48PM -0400, Cole Robinson wrote:
> 'default_backend' isn't always set, but 'rng' is, so use that.
> 
> $ ./x86_64-softmmu/qemu-system-x86_64 -object rng-random,id=rng0,filename=/dev/random -device virtio-rng-pci,rng=rng0
> Segmentation fault (core dumped)
> 
> Regressed with virtio refactoring in 59ccd20a9ac719cff82180429458728f03ec612f
> 
> CC: qemu-stable@nongnu.org
> Signed-off-by: Cole Robinson <crobinso@redhat.com>

Tested-by: Michael Roth <mdroth@linux.vnet.ibm.com>

Looking to pull this in for 1.5.1

> ---
> 
> Notes:
>     v2: Fix other instances in s390x code, pointed out by Frederic
> 
>  hw/s390x/s390-virtio-bus.c | 2 +-
>  hw/s390x/virtio-ccw.c      | 2 +-
>  hw/virtio/virtio-pci.c     | 2 +-
>  3 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/hw/s390x/s390-virtio-bus.c b/hw/s390x/s390-virtio-bus.c
> index a1cdfb0..207eb82 100644
> --- a/hw/s390x/s390-virtio-bus.c
> +++ b/hw/s390x/s390-virtio-bus.c
> @@ -300,7 +300,7 @@ static int s390_virtio_rng_init(VirtIOS390Device *s390_dev)
>      }
> 
>      object_property_set_link(OBJECT(dev),
> -                             OBJECT(dev->vdev.conf.default_backend), "rng",
> +                             OBJECT(dev->vdev.conf.rng), "rng",
>                               NULL);
> 
>      return s390_virtio_device_init(s390_dev, VIRTIO_DEVICE(vdev));
> diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c
> index 5f5e267..7dcd98d 100644
> --- a/hw/s390x/virtio-ccw.c
> +++ b/hw/s390x/virtio-ccw.c
> @@ -744,7 +744,7 @@ static int virtio_ccw_rng_init(VirtioCcwDevice *ccw_dev)
>      }
> 
>      object_property_set_link(OBJECT(dev),
> -                             OBJECT(dev->vdev.conf.default_backend), "rng",
> +                             OBJECT(dev->vdev.conf.rng), "rng",
>                               NULL);
> 
>      return virtio_ccw_device_init(ccw_dev, VIRTIO_DEVICE(vdev));
> diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c
> index 444b71a..b070b64 100644
> --- a/hw/virtio/virtio-pci.c
> +++ b/hw/virtio/virtio-pci.c
> @@ -1455,7 +1455,7 @@ static int virtio_rng_pci_init(VirtIOPCIProxy *vpci_dev)
>      }
> 
>      object_property_set_link(OBJECT(vrng),
> -                             OBJECT(vrng->vdev.conf.default_backend), "rng",
> +                             OBJECT(vrng->vdev.conf.rng), "rng",
>                               NULL);
> 
>      return 0;
> -- 
> 1.8.2.1
> 
> 

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

* Re: [Qemu-devel] [PATCH v2] virtio-rng: Fix crash with non-default backend
  2013-05-31 18:12 [Qemu-devel] [PATCH v2] virtio-rng: Fix crash with non-default backend Cole Robinson
                   ` (2 preceding siblings ...)
  2013-06-12 20:33 ` mdroth
@ 2013-06-21 15:34 ` Anthony Liguori
  3 siblings, 0 replies; 5+ messages in thread
From: Anthony Liguori @ 2013-06-21 15:34 UTC (permalink / raw)
  To: Cole Robinson, qemu-devel; +Cc: mst, qemu-stable, amit.shah, fred.konrad

Applied.  Thanks.

Regards,

Anthony Liguori

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

end of thread, other threads:[~2013-06-21 15:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-31 18:12 [Qemu-devel] [PATCH v2] virtio-rng: Fix crash with non-default backend Cole Robinson
2013-06-03  7:02 ` Amit Shah
2013-06-03 12:12 ` Michael S. Tsirkin
2013-06-12 20:33 ` mdroth
2013-06-21 15:34 ` Anthony Liguori

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).