From: Jan Beulich Date: Wed, 16 Sep 2015 09:20:27 +0000 (+0200) Subject: x86/MSI: fail if no hardware support X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~2534 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=c7d5d5d8ea1ecbd6ef8b47dace4dec825f0f6e48;p=xen.git x86/MSI: fail if no hardware support This is to guard against buggy callers (luckily Dom0 only) invoking the respective hypercall for a device not being MSI-capable. Signed-off-by: Jan Beulich Reviewed-by: Andrew Cooper --- diff --git a/xen/arch/x86/msi.c b/xen/arch/x86/msi.c index 588305ab9f..3dbb84ddac 100644 --- a/xen/arch/x86/msi.c +++ b/xen/arch/x86/msi.c @@ -696,6 +696,8 @@ static int msi_capability_init(struct pci_dev *dev, ASSERT(spin_is_locked(&pcidevs_lock)); pos = pci_find_cap_offset(seg, bus, slot, func, PCI_CAP_ID_MSI); + if ( !pos ) + return -ENODEV; control = pci_conf_read16(seg, bus, slot, func, msi_control_reg(pos)); maxvec = multi_msi_capable(control); if ( nvec > maxvec )