DragonFlyBSD Kernel Audit
DF-1814 / fix.diff
← back to finding ↓ download raw
diff --git a/sys/dev/raid/twa/tw_cl_init.c b/sys/dev/raid/twa/tw_cl_init.c
--- a/sys/dev/raid/twa/tw_cl_init.c
+++ b/sys/dev/raid/twa/tw_cl_init.c
@@ -702,7 +702,10 @@
 		0x1016, 0x1, TW_CL_SEVERITY_ERROR_STRING,
 		"init_connection failed",
 		"error = %d", error);
-	if (req)
+	/* On ETIMEDOUT, submit_and_poll_request already inserted the
+	 * PENDING request into the FREE_Q during its cleanup; re-inserting
+	 * here would corrupt the queue. */
+	if (req && error != TW_OSL_ETIMEDOUT)
 		tw_cli_req_q_insert_tail(req, TW_CLI_FREE_Q);
 	return(error);
 }