svn commit: r184842 - head/sys/kern

Andrew Gallatin gallatin at FreeBSD.org
Tue Nov 11 04:25:08 PST 2008


Author: gallatin
Date: Tue Nov 11 12:25:08 2008
New Revision: 184842
URL: http://svn.freebsd.org/changeset/base/184842

Log:
  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

Modified:
  head/sys/kern/subr_firmware.c

Modified: head/sys/kern/subr_firmware.c
==============================================================================
--- head/sys/kern/subr_firmware.c	Tue Nov 11 12:01:40 2008	(r184841)
+++ head/sys/kern/subr_firmware.c	Tue Nov 11 12:25:08 2008	(r184842)
@@ -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.
 	 */


More information about the svn-src-all mailing list