DragonFlyBSD Kernel Audit
DF-1903 / fix.diff
← back to finding ↓ download raw
diff --git a/sys/dev/disk/nvme/nvme_attach.c b/sys/dev/disk/nvme/nvme_attach.c
--- a/sys/dev/disk/nvme/nvme_attach.c
+++ b/sys/dev/disk/nvme/nvme_attach.c
@@ -475,6 +475,8 @@
 	/*
 	 * Stop the admin thread
 	 */
+	if (sc->iot == 0 || sc->ioh == 0)
+		goto skip_shutdown;
 	nvme_stop_admin_thread(sc);
 
 	/*
@@ -486,6 +488,7 @@
 	 * Disable the chip
 	 */
 	nvme_enable(sc, 0);
+skip_shutdown:
 
 	/*
 	 * Free admin memory