Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 17 Feb 2018 20:09:43 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r329464 - head/sys/compat/linuxkpi/common/include/linux
Message-ID:  <201802172009.w1HK9hQr029314@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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@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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201802172009.w1HK9hQr029314>