aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/cp
diff options
context:
space:
mode:
authorRoman Kurakin <rik@FreeBSD.org>2005-09-27 16:57:44 +0000
committerRoman Kurakin <rik@FreeBSD.org>2005-09-27 16:57:44 +0000
commit732c9a17013204144a82c8de5c63d26f8d07bb5d (patch)
tree8cdae507cb4db630749f512fed7b7da9a9611439 /sys/dev/cp
parenta0e81bce69d770642c8820fcdabd881dffde8039 (diff)
downloadsrc-732c9a17013204144a82c8de5c63d26f8d07bb5d.tar.gz
src-732c9a17013204144a82c8de5c63d26f8d07bb5d.zip
Restore if_cp.c 1.27
---------------------------- revision 1.27 date: 2005/09/19 03:10:16; author: imp; state: Exp; lines: +3 -2 Make sure that we call if_free(ifp) after bus_teardown_intr. Since we could get an interrupt after we free the ifp, and the interrupt handler depended on the ifp being still alive, this could, in theory, cause a crash. Eliminate this possibility by moving the if_free to after the bus_teardown_intr() call. In fact, this change do nothing for this driver. It is protected from this by cp_destroy variable. This variable also protects driver from initiation of any activity from network stack with disabled intr handler with this change applied.
Notes
Notes: svn path=/head/; revision=150624
Diffstat (limited to 'sys/dev/cp')
-rw-r--r--sys/dev/cp/if_cp.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/dev/cp/if_cp.c b/sys/dev/cp/if_cp.c
index 2adcfd66d543..d995c01964ec 100644
--- a/sys/dev/cp/if_cp.c
+++ b/sys/dev/cp/if_cp.c
@@ -614,6 +614,9 @@ static int cp_detach (device_t dev)
cp_reset (b, 0 ,0);
callout_stop (&led_timo[b->num]);
+ /* Disable the interrupt request. */
+ bus_teardown_intr (dev, bd->cp_irq, bd->cp_intrhand);
+
for (c=b->chan; c<b->chan+NCHAN; ++c) {
drv_t *d = (drv_t*) c->sys;
@@ -646,8 +649,6 @@ static int cp_detach (device_t dev)
b->sys = NULL;
CP_UNLOCK (bd);
- /* Disable the interrupt request. */
- bus_teardown_intr (dev, bd->cp_irq, bd->cp_intrhand);
bus_deactivate_resource (dev, SYS_RES_IRQ, 0, bd->cp_irq);
bus_release_resource (dev, SYS_RES_IRQ, 0, bd->cp_irq);
bus_release_resource (dev, SYS_RES_MEMORY, PCIR_BAR(0), bd->cp_res);