svn commit: r342843 - head/sys/dev/pccard

Warner Losh imp at FreeBSD.org
Mon Jan 7 06:19:52 UTC 2019


Author: imp
Date: Mon Jan  7 06:19:51 2019
New Revision: 342843
URL: https://svnweb.freebsd.org/changeset/base/342843

Log:
  Fix a race between setting up the interrupt handler and it firing by
  setting the data prior to setting up the interrupt. Now we only set
  the cookie afterwards, and that (a) cannot be helpd and (b) isn't used
  in the ISR.
  
  PR: 147127
  Submitted by: hps@

Modified:
  head/sys/dev/pccard/pccard.c

Modified: head/sys/dev/pccard/pccard.c
==============================================================================
--- head/sys/dev/pccard/pccard.c	Mon Jan  7 05:59:58 2019	(r342842)
+++ head/sys/dev/pccard/pccard.c	Mon Jan  7 06:19:51 2019	(r342843)
@@ -1272,13 +1272,16 @@ pccard_setup_intr(device_t dev, device_t child, struct
 
 	if (pf->intr_filter != NULL || pf->intr_handler != NULL)
 		panic("Only one interrupt handler per function allowed");
-	err = bus_generic_setup_intr(dev, child, irq, flags, pccard_filter, 
-	    intr ? pccard_intr : NULL, pf, cookiep);
-	if (err != 0)
-		return (err);
 	pf->intr_filter = filt;
 	pf->intr_handler = intr;
 	pf->intr_handler_arg = arg;
+	err = bus_generic_setup_intr(dev, child, irq, flags, pccard_filter,
+	    intr ? pccard_intr : NULL, pf, cookiep);
+	if (err != 0) {
+		pf->intr_filter = NULL;
+		pf->intr_handler = NULL;
+		return (err);
+	}
 	pf->intr_handler_cookie = *cookiep;
 	if (pccard_mfc(sc)) {
 		pccard_ccr_write(pf, PCCARD_CCR_OPTION,


More information about the svn-src-all mailing list