All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/vMsi-x: check whether the msixtbl_list has been initialized or not when accessing it
@ 2016-07-29  1:35 Chao Gao
  2016-07-29  9:30 ` Andrew Cooper
  0 siblings, 1 reply; 3+ messages in thread
From: Chao Gao @ 2016-07-29  1:35 UTC (permalink / raw)
  To: xen-devel; +Cc: andrew.cooper3, jbeulich, Chao Gao

MSI-x tables' initialization had been detered in the commit
74c6dc2d0ac4dcab0c6243cdf6ed550c1532b798. If an assigned device does not support
MSI-x, the msixtbl_list won't be initialized. Howerver, both of following paths
    XEN_DOMCTL_bind_pt_irq
        pt_irq_create_bind
            msixtbl_pt_register
and
    XEN_DOMCTL_unbind_pt_irq
        pt_irq_destroy_bind
            msixtbl_pt_unregister
do not check this case and will cause Xen panic consequently.

Signed-off-by: Chao Gao <chao.gao@intel.com>
---
 xen/arch/x86/hvm/vmsi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/hvm/vmsi.c b/xen/arch/x86/hvm/vmsi.c
index e418b98..e0d710b 100644
--- a/xen/arch/x86/hvm/vmsi.c
+++ b/xen/arch/x86/hvm/vmsi.c
@@ -449,7 +449,7 @@ int msixtbl_pt_register(struct domain *d, struct pirq *pirq, uint64_t gtable)
     ASSERT(pcidevs_locked());
     ASSERT(spin_is_locked(&d->event_lock));
 
-    if ( !has_vlapic(d) )
+    if ( !has_vlapic(d) || !d->arch.hvm_domain.msixtbl_list.next )
         return -ENODEV;
 
     /*
@@ -519,7 +519,7 @@ void msixtbl_pt_unregister(struct domain *d, struct pirq *pirq)
     ASSERT(pcidevs_locked());
     ASSERT(spin_is_locked(&d->event_lock));
 
-    if ( !has_vlapic(d) )
+    if ( !has_vlapic(d) || !d->arch.hvm_domain.msixtbl_list.next )
         return;
 
     irq_desc = pirq_spin_lock_irq_desc(pirq, NULL);
-- 
1.8.3.1


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

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

end of thread, other threads:[~2016-07-30  3:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-29  1:35 [PATCH] x86/vMsi-x: check whether the msixtbl_list has been initialized or not when accessing it Chao Gao
2016-07-29  9:30 ` Andrew Cooper
2016-07-30  3:00   ` gao, chao

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.