Avoid scheduling firmware taskqs when cold.

This prevents a panic which occurs when a driver attempts to load
firmware at boot via firmware_get() when the firmware module has not
been preloaded.  firmware_get() will  enqueue a task using a struct
taskqueue allocated on the stack, and the machine will crash much
later in the firmware taskq thread when taskqs are started and the
struct taskqueue is garbage.

Not objected to by: sam
This commit is contained in:
Andrew Gallatin 2008-11-11 12:25:08 +00:00
parent 279b2dd546
commit 528fb798ad
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=184842

View File

@ -325,9 +325,13 @@ firmware_get(const char *imagename)
* may do filesystem i/o which requires root & current dirs, etc.
* Also we must not hold any mtx's over this call which is problematic.
*/
TASK_INIT(&fwload_task, 0, loadimage, __DECONST(void *, imagename));
taskqueue_enqueue(firmware_tq, &fwload_task);
msleep(__DECONST(void *, imagename), &firmware_mtx, 0, "fwload", 0);
if (!cold) {
TASK_INIT(&fwload_task, 0, loadimage, __DECONST(void *,
imagename));
taskqueue_enqueue(firmware_tq, &fwload_task);
msleep(__DECONST(void *, imagename), &firmware_mtx, 0,
"fwload", 0);
}
/*
* After attempting to load the module, see if the image is registered.
*/