Fix panic if NVMe is detached before the intrhook call.

MFC after:	1 week
Sponsored by:	iXsystems, Inc.
This commit is contained in:
Alexander Motin 2020-11-12 20:20:43 +00:00
parent bdabd00d65
commit 46fbd8004f
2 changed files with 8 additions and 1 deletions

View File

@ -139,10 +139,15 @@ nvme_attach(device_t dev)
}
int
nvme_detach (device_t dev)
nvme_detach(device_t dev)
{
struct nvme_controller *ctrlr = DEVICE2SOFTC(dev);
if (ctrlr->config_hook.ich_arg != NULL) {
config_intrhook_disestablish(&ctrlr->config_hook);
ctrlr->config_hook.ich_arg = NULL;
}
nvme_ctrlr_destruct(ctrlr, dev);
return (0);
}

View File

@ -1135,6 +1135,7 @@ nvme_ctrlr_start_config_hook(void *arg)
fail:
nvme_ctrlr_fail(ctrlr);
config_intrhook_disestablish(&ctrlr->config_hook);
ctrlr->config_hook.ich_arg = NULL;
return;
}
@ -1152,6 +1153,7 @@ fail:
nvme_sysctl_initialize_ctrlr(ctrlr);
config_intrhook_disestablish(&ctrlr->config_hook);
ctrlr->config_hook.ich_arg = NULL;
ctrlr->is_initialized = 1;
nvme_notify_new_controller(ctrlr);