Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 11 Nov 2008 12:25:08 +0000 (UTC)
From:      Andrew Gallatin <gallatin@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r184842 - head/sys/kern
Message-ID:  <200811111225.mABCP8pN001610@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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.
 	 */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200811111225.mABCP8pN001610>