]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - virt/kvm/eventfd.c
kvm: Check irqchip mode before assign irqfd
[mirror_ubuntu-bionic-kernel.git] / virt / kvm / eventfd.c
index a5f1f8970b1f5598ff2749c221c85b98fd90e957..dfcedee66e9db83a8349e6a2d1d17ce56eef7bc1 100644 (file)
 
 static struct workqueue_struct *irqfd_cleanup_wq;
 
+bool __attribute__((weak))
+kvm_arch_irqfd_allowed(struct kvm *kvm, struct kvm_irqfd *args)
+{
+       return true;
+}
+
 static void
 irqfd_inject(struct work_struct *work)
 {
@@ -297,6 +303,9 @@ kvm_irqfd_assign(struct kvm *kvm, struct kvm_irqfd *args)
        if (!kvm_arch_intc_initialized(kvm))
                return -EAGAIN;
 
+       if (!kvm_arch_irqfd_allowed(kvm, args))
+               return -EINVAL;
+
        irqfd = kzalloc(sizeof(*irqfd), GFP_KERNEL);
        if (!irqfd)
                return -ENOMEM;