diff options
author | gallatin <gallatin@FreeBSD.org> | 2008-11-11 12:25:08 +0000 |
---|---|---|
committer | gallatin <gallatin@FreeBSD.org> | 2008-11-11 12:25:08 +0000 |
commit | 5b802b524bc0cd8e922224203f9cbeb05b7e8308 (patch) | |
tree | 2dffb10ee1c20a1b64b93c2a12b7fc4ddab6ff2b /sys/kern | |
parent | 012446002add131d850c84ee67fea5054d9329d7 (diff) | |
download | FreeBSD-src-5b802b524bc0cd8e922224203f9cbeb05b7e8308.zip FreeBSD-src-5b802b524bc0cd8e922224203f9cbeb05b7e8308.tar.gz |
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
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/subr_firmware.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/sys/kern/subr_firmware.c b/sys/kern/subr_firmware.c index d1450e6..24b829e 100644 --- a/sys/kern/subr_firmware.c +++ b/sys/kern/subr_firmware.c @@ -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. */ |