svn commit: r329464 - head/sys/compat/linuxkpi/common/include/linux

Hans Petter Selasky hselasky at FreeBSD.org
Sat Feb 17 20:09:44 UTC 2018


Author: hselasky
Date: Sat Feb 17 20:09:43 2018
New Revision: 329464
URL: https://svnweb.freebsd.org/changeset/base/329464

Log:
  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 at gmail.com>
  Sponsored by:	Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/include/linux/interrupt.h

Modified: head/sys/compat/linuxkpi/common/include/linux/interrupt.h
==============================================================================
--- head/sys/compat/linuxkpi/common/include/linux/interrupt.h	Sat Feb 17 18:30:25 2018	(r329463)
+++ head/sys/compat/linuxkpi/common/include/linux/interrupt.h	Sat Feb 17 20:09:43 2018	(r329464)
@@ -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);


More information about the svn-src-all mailing list