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. MFC after: 1 week Submitted by: Johannes Lundberg <johalun0@gmail.com> Sponsored by: Mellanox Technologies
This commit is contained in:
parent
0dd68d38d3
commit
49f93b7a06
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user