diff options
author | Warner Losh <imp@FreeBSD.org> | 2019-01-07 06:19:51 +0000 |
---|---|---|
committer | Warner Losh <imp@FreeBSD.org> | 2019-01-07 06:19:51 +0000 |
commit | a7db1b744a1b2708d86b53fe1c445ec166c38f87 (patch) | |
tree | 26926abdeceaf3063b5d9a50e01ed011e7cc2d2c /sys | |
parent | 7afbd60504ef1f0efdf248aa12e121c33b7fee0f (diff) | |
download | src-a7db1b744a1b2708d86b53fe1c445ec166c38f87.tar.gz src-a7db1b744a1b2708d86b53fe1c445ec166c38f87.zip |
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@
Notes
Notes:
svn path=/head/; revision=342843
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/pccard/pccard.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/sys/dev/pccard/pccard.c b/sys/dev/pccard/pccard.c index 1553a49fbb4e..f231ab9d69dd 100644 --- a/sys/dev/pccard/pccard.c +++ b/sys/dev/pccard/pccard.c @@ -1272,13 +1272,16 @@ pccard_setup_intr(device_t dev, device_t child, struct resource *irq, 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, |