qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] vhost: check region type before casting


From: Tiwei Bie
Subject: Re: [Qemu-devel] [PATCH] vhost: check region type before casting
Date: Wed, 1 Aug 2018 16:22:44 +0800
User-agent: Mutt/1.10.1 (2018-07-13)

Ping..

It seems that the final release for QEMU 3.0 will be
out soon [1]. But this fix hasn't been merged yet.

[1] https://lists.nongnu.org/archive/html/qemu-devel/2018-07/msg06004.html

Thanks,
Tiwei

On Fri, Jul 20, 2018 at 04:36:44PM +0800, Tiwei Bie wrote:
> Check region type first before casting the memory region
> to IOMMUMemoryRegion. Otherwise QEMU will abort with below
> error message when casting non-IOMMU memory region:
> 
> vhost_iommu_region_add: Object 0x561f28bce4f0 is not an
> instance of type qemu:iommu-memory-region
> 
> Fixes: cb1efcf462a2 ("iommu: Add IOMMU index argument to notifier APIs")
> Cc: Peter Maydell <address@hidden>
> 
> Signed-off-by: Tiwei Bie <address@hidden>
> ---
>  hw/virtio/vhost.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
> index b129cb9ddd..d4cb5894a8 100644
> --- a/hw/virtio/vhost.c
> +++ b/hw/virtio/vhost.c
> @@ -663,12 +663,14 @@ static void vhost_iommu_region_add(MemoryListener 
> *listener,
>      struct vhost_iommu *iommu;
>      Int128 end;
>      int iommu_idx;
> -    IOMMUMemoryRegion *iommu_mr = IOMMU_MEMORY_REGION(section->mr);
> +    IOMMUMemoryRegion *iommu_mr;
>  
>      if (!memory_region_is_iommu(section->mr)) {
>          return;
>      }
>  
> +    iommu_mr = IOMMU_MEMORY_REGION(section->mr);
> +
>      iommu = g_malloc0(sizeof(*iommu));
>      end = int128_add(int128_make64(section->offset_within_region),
>                       section->size);
> -- 
> 2.18.0
> 
> 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]