From 20e2b00638b812a7a7aa294e1c03ac75d9eb695e Mon Sep 17 00:00:00 2001 From: "Sunip K. Mukherjee" Date: Tue, 25 Apr 2023 14:31:59 -0400 Subject: [PATCH] Bugfix for kernel pagefault in apci_wait_irq() for devices incapable of generating IRQ. --- apci_fops.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/apci_fops.c b/apci_fops.c index a0e83e8..ea63ed1 100644 --- a/apci_fops.c +++ b/apci_fops.c @@ -261,6 +261,12 @@ long ioctl_apci(struct file *filp, unsigned int cmd, unsigned long arg) case apci_wait_for_irq_ioctl: + if (!ddata->irq_capable) + { + apci_error("Not capable of generating IRQs.\n"); + return -EINVAL; + } + if (ddata->irq_disabled) { apci_error("IRQ is disabled.\n"); @@ -298,6 +304,12 @@ long ioctl_apci(struct file *filp, unsigned int cmd, unsigned long arg) break; case apci_cancel_wait_ioctl: + if (!ddata->irq_capable) + { + apci_error("Not capable of generating IRQs.\n"); + return -EINVAL; + } + if (ddata->irq_disabled) { apci_error("IRQ is disabled.\n");