DragonFlyBSD Kernel Audit
DF-2512 / fix.diff
← back to finding ↓ download raw
diff --git a/sys/dev/disk/nvme/nvme_admin.c b/sys/dev/disk/nvme/nvme_admin.c
--- a/sys/dev/disk/nvme/nvme_admin.c
+++ b/sys/dev/disk/nvme/nvme_admin.c
@@ -630,6 +630,14 @@
 		status = nvme_wait_request(req);
 		if (status != 0) {
 			kprintf("NS FAILED %08x\n", status);
+			/* Release the admin request on failure.  Each failed
+			 * Identify-NS otherwise permanently removes one slot
+			 * from the admin submission queue's first_avail free
+			 * list; a device advertising many namespaces and
+			 * failing each Identify trips KKASSERT(queue->qid!=0)
+			 * on the next nvme_get_admin_request() once the pool
+			 * (maxqe-1) is exhausted.  See DF-2512. */
+			nvme_put_request(req);
 			continue;
 		}