Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 25 Feb 2018 10:22:27 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r329957 - stable/11/sys/compat/linuxkpi/common/include/linux
Message-ID:  <201802251022.w1PAMREM012655@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Sun Feb 25 10:22:27 2018
New Revision: 329957
URL: https://svnweb.freebsd.org/changeset/base/329957

Log:
  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

Modified:
  stable/11/sys/compat/linuxkpi/common/include/linux/interrupt.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/compat/linuxkpi/common/include/linux/interrupt.h
==============================================================================
--- stable/11/sys/compat/linuxkpi/common/include/linux/interrupt.h	Sun Feb 25 10:21:31 2018	(r329956)
+++ stable/11/sys/compat/linuxkpi/common/include/linux/interrupt.h	Sun Feb 25 10:22:27 2018	(r329957)
@@ -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?201802251022.w1PAMREM012655>