DragonFlyBSD Kernel Audit
DF-1924 / fix.diff
← back to finding ↓ download raw
diff --git a/sys/dev/raid/tws/tws_hdm.c b/sys/dev/raid/tws/tws_hdm.c
--- a/sys/dev/raid/tws/tws_hdm.c
+++ b/sys/dev/raid/tws/tws_hdm.c
@@ -97,7 +97,10 @@
     }
 
 
+    {
+    int _tmo = TWS_RESET_TIMEOUT;
     while( 1 ) {
+        if (--_tmo <= 0) break;
         regh = tws_read_reg(sc, TWS_I2O0_IOPOBQPH, 4);
         regl = tws_read_reg(sc, TWS_I2O0_IOPOBQPL, 4);
 #ifdef TWS_DEBUG
@@ -106,6 +109,7 @@
         TWS_TRACE_DEBUG(sc, "host outbound cleanup", reg, regl);
         if ( regh == TWS_FIFO_EMPTY32 )
             break;
+    }
     }
 
     tws_init_obfl_q(sc);