Module Name:    src
Committed By:   tls
Date:           Sun Nov 20 00:45:16 UTC 2011

Modified Files:
        src/sys/dev: rnd.c

Log Message:
Add very, very temporary and ugly work around for my braino about detaching bad 
devices.  Will fix as soon as I have more time with the hardware where I can 
reproduce this.


To generate a diff of this commit:
cvs rdiff -u -r1.84 -r1.85 src/sys/dev/rnd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/rnd.c
diff -u src/sys/dev/rnd.c:1.84 src/sys/dev/rnd.c:1.85
--- src/sys/dev/rnd.c:1.84	Sun Nov 20 00:28:51 2011
+++ src/sys/dev/rnd.c	Sun Nov 20 00:45:15 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rnd.c,v 1.84 2011/11/20 00:28:51 tls Exp $	*/
+/*	$NetBSD: rnd.c,v 1.85 2011/11/20 00:45:15 tls Exp $	*/
 
 /*-
  * Copyright (c) 1997-2011 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rnd.c,v 1.84 2011/11/20 00:28:51 tls Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rnd.c,v 1.85 2011/11/20 00:45:15 tls Exp $");
 
 #include <sys/param.h>
 #include <sys/ioctl.h>
@@ -52,6 +52,7 @@ __KERNEL_RCSID(0, "$NetBSD: rnd.c,v 1.84
 #include <sys/kauth.h>
 #include <sys/once.h>
 #include <sys/rngtest.h>
+#include <sys/cpu.h>	/* XXX temporary, see rnd_detach_source */
 
 #if defined(__HAVE_CPU_COUNTER) && !defined(_RUMPKERNEL) /* XXX: bad pooka */
 #include <machine/cpu_counter.h>
@@ -968,13 +969,15 @@ rnd_detach_source(krndsource_t *source)
 
 	mutex_spin_exit(&rnd_mtx);
 
-	if (source->state) {
-		rnd_sample_free(source->state);
-		source->state = NULL;
-	}
+	if (!cpu_softintr_p()) {	/* XXX XXX very temporary "fix" */
+		if (source->state) {
+			rnd_sample_free(source->state);
+			source->state = NULL;
+		}
 
-	if (source->test) {
-		kmem_free(source->test, sizeof(rngtest_t));
+		if (source->test) {
+			kmem_free(source->test, sizeof(rngtest_t));
+		}
 	}
 
 #ifdef RND_VERBOSE

Reply via email to