cam: Fix race condition in dainit()

Previously, daregister() could have been called before dainit()
initialized the UMA zone.  This would trip a KASSERT.

Reported By:	pho
Tested By:	pho
Sponsored by:	NetApp, Inc.
Sponsored by:	Klara, Inc.
This commit is contained in:
Edward Tomasz Napierala 2021-05-16 10:35:31 +01:00
parent 0f206cc912
commit 8252fe56a0

View File

@ -2001,6 +2001,10 @@ dainit(void)
{
cam_status status;
da_ccb_zone = uma_zcreate("da_ccb",
sizeof(struct ccb_scsiio), NULL, NULL, NULL, NULL,
UMA_ALIGN_PTR, 0);
/*
* Install a global async callback. This callback will
* receive async callbacks like "new device found".
@ -2016,10 +2020,6 @@ dainit(void)
NULL, SHUTDOWN_PRI_DEFAULT)) == NULL)
printf("dainit: shutdown event registration failed!\n");
}
da_ccb_zone = uma_zcreate("da_ccb",
sizeof(struct ccb_scsiio), NULL, NULL, NULL, NULL,
UMA_ALIGN_PTR, 0);
}
/*