⬢ DragonFlyBSD Kernel Audit
DF-5027 / fix.diff
← back to finding ↓ download raw
diff --git a/sys/dev/raid/ips/ips_disk.c b/sys/dev/raid/ips/ips_disk.c
--- a/sys/dev/raid/ips/ips_disk.c
+++ b/sys/dev/raid/ips/ips_disk.c
@@ -262,6 +262,20 @@
 			error = EIO;
 			break;
 		}
+		if (command->completed == 0) {
+			/*
+			 * ips_poll_cmd() never delivered a completion --
+			 * on copperhead adapters it is an unimplemented
+			 * stub that only kprintfs, so command->status is
+			 * still the zeroed value from ips_get_free_cmd()
+			 * and COMMAND_ERROR() above can never fire.  Do
+			 * not report these blocks as dumped.
+			 */
+			kprintf("ipsd: dump command never completed\n");
+			error = EIO;
+			break;
+		}
+		command->completed = 0;
 
 		length -= len;
 		off += len;
@@ -326,6 +340,7 @@
 static void
 ipsd_dump_block_complete(ips_command_t *command)
 {
+	command->completed = 1;
 	if (COMMAND_ERROR(&command->status)) {
 		kprintf("ipsd_dump completion error= 0x%x\n",
 		       command->status.value);