Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 7 Jan 2019 06:19:51 +0000 (UTC)
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r342843 - head/sys/dev/pccard
Message-ID:  <201901070619.x076JpAl095531@repo.freebsd.org>

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



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