⬢ DragonFlyBSD Kernel Audit
DF-3950 / fix.diff
← back to finding ↓ download raw
diff --git a/sys/dev/raid/mlx/mlx.c b/sys/dev/raid/mlx/mlx.c
--- a/sys/dev/raid/mlx/mlx.c
+++ b/sys/dev/raid/mlx/mlx.c
@@ -1654,8 +1654,9 @@ mlx_wait_command(struct mlx_command *mc)
 
     count = 0;
     /* XXX better timeout? */
-    while ((mc->mc_status == MLX_STATUS_BUSY) && (count < 30)) {
+    while ((mc->mc_status == MLX_STATUS_BUSY) && (count++ < 30)) {
 	tsleep(mc->mc_private, PCATCH, "mlxwcmd", hz);
     }
+    /* fall through with error if the command never completed in 30s */
 
     if (mc->mc_status != 0) {
 	device_printf(sc->mlx_dev, "command failed - %s\n", mlx_diagnose_command(mc));