qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] kvm: check dev parameter when updating msi rout


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH] kvm: check dev parameter when updating msi route
Date: Mon, 5 Feb 2018 17:57:19 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2

On 05/02/2018 07:18, P J P wrote:
> From: Prasad J Pandit <address@hidden>
> 
> When updating message signalled interrupt(MSI) route in routine
> kvm_irqchip_update_msi_route, device parameter could be null.
> Add check to avoid null dereference.
> 
> Reported-by: Guoxiang Niu <address@hidden>
> Signed-off-by: Prasad J Pandit <address@hidden>

Please include the full backtrace.  On a machine that needs
KVM_MSI_VALID_DEVID, it should not be possible to associate MSIs with
non-PCI devices (dev should only be NULL for x86 with "-machine
kernel_irqchip=split", and x86 does not need KVM_MSI_VALID_DEVID).

Paolo

> ---
>  accel/kvm/kvm-all.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
> index f290f487a5..cb7613d282 100644
> --- a/accel/kvm/kvm-all.c
> +++ b/accel/kvm/kvm-all.c
> @@ -1167,7 +1167,7 @@ int kvm_irqchip_add_msi_route(KVMState *s, int vector, 
> PCIDevice *dev)
>      kroute.u.msi.address_lo = (uint32_t)msg.address;
>      kroute.u.msi.address_hi = msg.address >> 32;
>      kroute.u.msi.data = le32_to_cpu(msg.data);
> -    if (pci_available && kvm_msi_devid_required()) {
> +    if (pci_available && dev && kvm_msi_devid_required()) {
>          kroute.flags = KVM_MSI_VALID_DEVID;
>          kroute.u.msi.devid = pci_requester_id(dev);
>      }
> @@ -1205,7 +1205,7 @@ int kvm_irqchip_update_msi_route(KVMState *s, int virq, 
> MSIMessage msg,
>      kroute.u.msi.address_lo = (uint32_t)msg.address;
>      kroute.u.msi.address_hi = msg.address >> 32;
>      kroute.u.msi.data = le32_to_cpu(msg.data);
> -    if (pci_available && kvm_msi_devid_required()) {
> +    if (pci_available && dev && kvm_msi_devid_required()) {
>          kroute.flags = KVM_MSI_VALID_DEVID;
>          kroute.u.msi.devid = pci_requester_id(dev);
>      }
> 



reply via email to

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