diff options
author | Andrew Gallatin <gallatin@FreeBSD.org> | 2008-11-11 12:25:08 +0000 |
---|---|---|
committer | Andrew Gallatin <gallatin@FreeBSD.org> | 2008-11-11 12:25:08 +0000 |
commit | 528fb798adfd4cbe8422d53779d3b44b24756d85 (patch) | |
tree | 2dffb10ee1c20a1b64b93c2a12b7fc4ddab6ff2b /sys/kern/subr_firmware.c | |
parent | 279b2dd5463e79bb876b5ffbadbd648a2237d3c9 (diff) | |
download | src-528fb798adfd4cbe8422d53779d3b44b24756d85.tar.gz src-528fb798adfd4cbe8422d53779d3b44b24756d85.zip |
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
Notes
Notes:
svn path=/head/; revision=184842
Diffstat (limited to 'sys/kern/subr_firmware.c')
-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 d1450e642182..24b829e2ed5c 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. */ |