[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 3/3] s390-virtio-bus: sync config only when conf
From: |
Michael S. Tsirkin |
Subject: |
Re: [Qemu-devel] [PATCH 3/3] s390-virtio-bus: sync config only when config_len is not zero |
Date: |
Sun, 28 Apr 2013 11:31:39 +0300 |
On Fri, Apr 26, 2013 at 04:34:04PM +0800, Jason Wang wrote:
> virtio-rng-s390 has zero config length, so no need to sync its config
> otherwise
> qemu will crash since vdev->config is NULL.
>
> Cc: Alexander Graf <address@hidden>
> Cc: Richard Henderson <address@hidden>
> Signed-off-by: Jason Wang <address@hidden>
Actully, it validates get_config so what's the problem here?
> ---
> hw/s390x/s390-virtio-bus.c | 4 ++++
> 1 files changed, 4 insertions(+), 0 deletions(-)
>
> diff --git a/hw/s390x/s390-virtio-bus.c b/hw/s390x/s390-virtio-bus.c
> index dabbc2e..0f83516 100644
> --- a/hw/s390x/s390-virtio-bus.c
> +++ b/hw/s390x/s390-virtio-bus.c
> @@ -350,6 +350,10 @@ void s390_virtio_device_sync(VirtIOS390Device *dev)
> dev->feat_offs = cur_offs + dev->feat_len;
> cur_offs += dev->feat_len * 2;
>
> + if (!dev->vdev->config_len) {
> + return;
> + }
> +
> /* Sync config space */
> if (dev->vdev->get_config) {
> dev->vdev->get_config(dev->vdev, dev->vdev->config);
> --
> 1.7.1
Re: [Qemu-devel] [PATCH 1/3] virtio-pci: properly validate address before accessing config, Michael S. Tsirkin, 2013/04/27