DragonFlyBSD Kernel Audit
DF-1731 / fix.diff
← back to finding ↓ download raw
diff --git a/sys/dev/raid/tws/tws.c b/sys/dev/raid/tws/tws.c
--- a/sys/dev/raid/tws/tws.c
+++ b/sys/dev/raid/tws/tws.c
@@ -264,12 +264,6 @@
     sc->bus_mfa_handle = rman_get_bushandle(sc->mfa_res);
 #endif
 
-    /* Allocate and register our interrupt. */
-    if ( tws_setup_irq(sc) == FAILURE ) {
-        tws_log(sc, ALLOC_MEMORY_RES);
-        goto attach_fail_3;
-    }
-
     /* Init callouts. */
     callout_init(&sc->print_stats_handle);
     callout_init(&sc->reset_cb_handle);
@@ -289,6 +283,11 @@
     if ( tws_init(sc) == FAILURE ) {
         tws_log(sc, TWS_INIT_FAILURE);
         goto attach_fail_4;
+    }
+    /* Allocate and register our interrupt (after tws_init so reqs are allocated). */
+    if ( tws_setup_irq(sc) == FAILURE ) {
+        tws_log(sc, ALLOC_MEMORY_RES);
+        goto attach_fail_3;
     }
     if ( tws_init_ctlr(sc) == FAILURE ) {
         tws_log(sc, TWS_CTLR_INIT_FAILURE);