diff options
author | hselasky <hselasky@FreeBSD.org> | 2018-02-25 10:22:27 +0000 |
---|---|---|
committer | hselasky <hselasky@FreeBSD.org> | 2018-02-25 10:22:27 +0000 |
commit | 92c6f0193083e0851d95292ddc87f5d31c74d8b5 (patch) | |
tree | 14295fb7d3bcc58b4bff47205ff4211ba14cdf75 | |
parent | 46bfe7c04b6f3eb3e260dfcea8b2b0aa62720cd7 (diff) | |
download | FreeBSD-src-92c6f0193083e0851d95292ddc87f5d31c74d8b5.zip FreeBSD-src-92c6f0193083e0851d95292ddc87f5d31c74d8b5.tar.gz |
MFC r329464:
Add checks for valid IRQ tag before setting up or tearing down an interrupt
handler in the LinuxKPI. This is needed when the interrupt handler is disabled
before freeing the interrupt.
Submitted by: Johannes Lundberg <johalun0@gmail.com>
Sponsored by: Mellanox Technologies
-rw-r--r-- | sys/compat/linuxkpi/common/include/linux/interrupt.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/compat/linuxkpi/common/include/linux/interrupt.h b/sys/compat/linuxkpi/common/include/linux/interrupt.h index 0d9a665..c594898 100644 --- a/sys/compat/linuxkpi/common/include/linux/interrupt.h +++ b/sys/compat/linuxkpi/common/include/linux/interrupt.h @@ -121,7 +121,7 @@ enable_irq(unsigned int irq) if (dev == NULL) return -EINVAL; irqe = linux_irq_ent(dev, irq); - if (irqe == NULL) + if (irqe == NULL || irqe->tag != NULL) return -EINVAL; return -bus_setup_intr(dev->bsddev, irqe->res, INTR_TYPE_NET | INTR_MPSAFE, NULL, linux_irq_handler, irqe, &irqe->tag); @@ -139,7 +139,8 @@ disable_irq(unsigned int irq) irqe = linux_irq_ent(dev, irq); if (irqe == NULL) return; - bus_teardown_intr(dev->bsddev, irqe->res, irqe->tag); + if (irqe->tag != NULL) + bus_teardown_intr(dev->bsddev, irqe->res, irqe->tag); irqe->tag = NULL; } @@ -174,7 +175,8 @@ free_irq(unsigned int irq, void *device) irqe = linux_irq_ent(dev, irq); if (irqe == NULL) return; - bus_teardown_intr(dev->bsddev, irqe->res, irqe->tag); + if (irqe->tag != NULL) + bus_teardown_intr(dev->bsddev, irqe->res, irqe->tag); bus_release_resource(dev->bsddev, SYS_RES_IRQ, rid, irqe->res); list_del(&irqe->links); kfree(irqe); |